iOS 10 Programming Fundamentals with Swift 学习笔记 0

Posted 李长鸿

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS 10 Programming Fundamentals with Swift 学习笔记 0相关的知识,希望对你有一定的参考价值。

1,a single statement can be broken into multiple lines ,For example, after an opening parenthesis is a good place:

print(

  "world")

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

3,An object type can be extended in Swift, meaning that you can define your own messages on that type. For example, you can’t normally send the say- Hello message to a number. But you can change a number type so that you can:

    extension Int {
        func sayHello() {
            print("Hello, I‘m \(self)")
        }
    }
    1.sayHello() // outputs: "Hello, I‘m 1"

4, what “everything is an object” really means. ?

In Swift, then, 1 is an object. In some languages, such as Objective-C, it clearly is not; it is a “primitive” or scalar built-in data type. So the distinction being drawn here is between object types on the one hand and scalars on the other. In Swift, there are no scalars; all types are ultimately object types. That’s what “everything is an object” really means. 

5,

 

 

以上是关于iOS 10 Programming Fundamentals with Swift 学习笔记 0的主要内容,如果未能解决你的问题,请参考以下文章