Swift Small note

Source: Internet
Author: User
Tags scalar

1, optional type.

1. Escape special characters (null character), \ \ (backslash), \ t (horizontal tab), \ n (newline character), \ r (carriage return), \ "(double quotation mark), \ ' (single quotation mark).

2. Single-byte Unicode scalar, written as \xnn, where nn is a two-bit hexadecimal number.

3. Double-byte Unicode scalar, written as \unnnn, where nnnn is a four-bit hexadecimal number.
4. Four-byte Unicode scalar, written as \unnnnnnnn, where nnnnnnnn is a eight-bit hexadecimal number.

5 . Note: The struct is passed in the code in the way it is copied, so do not use reference counting.

Struct instances are always passed by value, and class instances are always passed by reference.
Computed properties can be used in classes, structs, and enumerations, and stored properties are used only for classes and struct bodies.

Classes that belong to reference types are different, and when you assign an instance of a reference type to a constant, you can still fix the

The variable property of the instance is changed.

6.

Because a class is a reference type, there may be multiple constants and variables that reference a class instance at the same time in the background. (This is not true for structs and enumerations.) Because they are value types, they are assigned to constants, variables, or passed to functions

, they are always copied. )

7.

In addition to storing properties, classes, structs, and enumerations can define computed properties, and computed properties do not store values directly, but instead provide a

Getter to get a value, an optional setter to indirectly set the value of another property or variable.

Swift Small note

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.