[Swift] Inheritance
Superclass and subclass parent class is super class child class is subclass child class can use all things of parent class single inheritance.
Superclass and subclass parent class is super class child class is subclass child class can use all things of parent class single inheritance.
Extension add property
Closure Closure is independent code block
Property need the initial value. initial value Initialize to init optional variable, constant
Method function in class, struct and enum.
For loop for var i = 0; i < 10; i+=1 { print(i) } // error // C-style for statement has been removed in Swift 3 ```swift for i in 0..<10 { pri...
If var x = 10 if x > 5 { print("greater than 5") } If -else var x = 2 if x % 2 == 0 { print("even number") } else { print("odd number") }
Upcasting (as) Child instance as parent class Safe casting
Int 10 Int Store Int-type values
var Values assigned to variables can be changed var myVar = 10 // :Int var x = 0.0, y = 0.0, z = 0.0
Data type basic Saving Numbers in a Swift Program var num : Int = 10 var num = 10 If there is an initial value as shown above, the com...
Print print(1, 2, 3, 4, 5) // 1 2 3 4 5 print(1, 2, 3, 4, 5, separator: "-") // 1-2-3-4-5 separator : print the string between each item