Swift is a new language used to design iOS and Mac OS X applications.
Swift features
? Swift retains the advantages of C and Objective-C and abandons the limitations it imposes to be compatible with the C language.
? Swift incorporates the security programming model and adds some modern features to make it easier to use, more flexible, and more fun.
? The combination of Swift's simple and clean style and popular box-ready Cocoa/Cocoa Touch will bring new opportunities for the new software development process.
? Swift memory management adopts the ARC style.
Swift code file extension *. swift
Operator
? Arithmetic Operators, +,-, *,/, %,
++ ,--
? Relational operators,>, <, >=, <=, = ,! =
? Boolean logical operator ,! , &, |
? Ternary operator ,? :
Expression
1. do not specify the Data Type
Var a1 = 10 var a2 = 20
Var a = a1> a2? "A1": "a2"
2. Specify the Data Type
Var a1: Int = 10 var a2: Int = 20
Var a = a1> a2? "A1": "a2"
3. You can end with a semicolon.
Var a1: Int = 10; var a2: Int = 20 var a = a1> a2? "A1": "a2"
Note
//
/**/
Swift discussion forum: http://www.cocoagame.net
Welcome to the Swift technology exchange group: 362298485