Summary: Swift is a new programming language for writing iOS and OS X apps. Swift combines the advantages of C and objective-c and is not limited by C compatibility. Swift uses a secure programming model and adds a lot of new features, which makes programming easier, more flexible, and more fun. Swift is based on a mature and beloved Cocoa and Cocoa Touch framework, and its advent will redefine software development. Swift is also very friendly for beginners. It is the first programming language that satisfies both industry standards and is as expressive and interesting as the scripting language. It supports code previews, a revolutionary feature that allows programmers to run Swift code without compiling and running the application and view the results in real time.
Constants & Variables
- Periodic summary
varDefine variables that can be modified after they are set
letDefines constants that cannot be modified after they are set
- Do not use at end of statement
;
- In Swift, use
println() an alternative in OCNSLog
printlnPerformance is better and will be demonstrated later
Defined
OCObject
- Periodic summary
- In the
Swift format that you want to instantiate an object 类名() with, the OC equivalent in alloc/init
OCinitWithXXX Swift can be used to 类名(XXX: ) find the corresponding function in the
OCA [UIColor redColor] class method in which Swift you can usually 类名.XXX find the corresponding function in the
- Use
let adornments v and assign values to indicate该常量的内存地址不允许修改,但是可以修改其内部的属性
swift-Initial (1)