Swift is a new language for designing IOS and Mac OS X applications.
Swift Features
? Swift retains the strengths of C and Objective-c and rejects the restrictions it has imposed in order to be compatible with the C language.
? Swift incorporates a secure programming model and adds some modern features to make it easier to use, more flexible, and more fun.
? Swift's simple style, combined with the popular, mature framework Cocoa/cocoa Touch, will bring new opportunities to the development process of another conceived software.
? Swift memory management uses ARC style.
Swift code file extension *.swift
Operator
? Arithmetic operator, +,-, *,/,%,
+ +,--
? relational operators, >, <, >=, <=, = =,! =
? Boolean logical operators,! , &&, | |
? Ternary operator,? :
An expression
1. Do not specify a data type
var A1 = ten 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, can have a semicolon end
var a1:int = 10; var a2:int = var a = a1> A2? "A1": "A2"
Gaze
//
/* */
Swift Exchange Discussion Forum Forum: http://www.cocoagame.net
Welcome to add Swift Technology Group: 362298485
Swift Overview and Swift operators and expressions