Source file extension for 1.Swift. Swift
2. Two not required: ① do not need to write the main function ② no need to add a semicolon after each statement
3. Multi-line annotations can be nested
4.let declaring a constant VAR declaration variable
Let radius = 10
var x= 0,y = 0,z = 0
5.UIImageView
var ImageView = Uiimageview ()
Imageview.image = UIImage (name: "002.png")
Imageview.frame = CGRectMake (20,20,100,50)
Self.view.addSubview (ImageView)
6.Playground
7. String
①: General form
Let Web = "xxxxxxx"
②: Stitching plus +
Let str = "123"
Let str2 = "456"
Let dest = str + str2
③: Interpolation
Let hand = 2
var age = 20
Let str = "I am (age) year old, have \ (hand) only Hand"
④: Type Conversion
var age = 10
Convert to string: <1>var str = string (age) <2>var str2 = "\ (age)"
8: Print Output function
PRINTLN: Output will be wrapped automatically
Print: Less line wrapping
code example: ①println ("Learn Swift") ②let name = "Learn Swift + learn x\n"; Print (name)
9: Names of constants and variables
Any..... (Control + COMMAND + space-----Pop-up emoji keyboard)
Attention:
Attack on Swift-------variable, constant