码迷,mamicode.com
首页 > 移动开发 > 详细

iOS 10 Programming Fundamentals with Swift 学习笔记 0

时间:2017-04-11 13:38:08      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:lin   hello   tin   one   output   can   single   mpi   compile   

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

标签:lin   hello   tin   one   output   can   single   mpi   compile   

原文地址:http://www.cnblogs.com/huntaiji/p/6692250.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!