IOS programming Fundamentals with Swift learning Note 0

Source: Internet
Author: User

1,a Single statement can be broken to multiple lines, for example, after an opening parenthesis are a good place:

Print

"World")

2,swift is a compiled language, the syntax of message-sending are dot-notation. Every noun is an object, and every verb is a message.

3,an object type can be extended in Swift, meaning so can define your own messages on the that type. For example, you can ' t normally send the Say-hello message to a number. But you can change a number of type so it can:

    Extension Int {        func SayHello () {
            Print ("Hello, I ' m \ (self)")        }
    }    1.sayHello ()//outputs: "Hello, I ' M 1"

4, what "Everything are an object" really means. ?

In Swift, then, 1 are an object. In some languages, such as objective-c, it clearly are not; It is a "primitive" or scalar built-in data type. So the distinction being drawn are between object types on the one hand and scalars on the other. In Swift, there is no scalars; All types is ultimately object types. That's what "everything was an object" really means.

5,

IOS programming Fundamentals with Swift learning Note 0

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.