Programare swift Swift tutorial from tutorials point | Page 4
Swift 4
Type Safety ........................................................................................................................................... 13
Type Inference ...................................................................................................................................... 13
5.
SWIFT 4 – VARIABLES ........................................................................................................ 15
Variable Declaration.............................................................................................................................. 15
Type Annotations .................................................................................................................................. 16
Naming Variables .................................................................................................................................. 16
Printing Variables .................................................................................................................................. 17
6.
SWIFT 4 – OPTIONALS ....................................................................................................... 18
Forced Unwrapping ............................................................................................................................... 18
Automatic Unwrapping ......................................................................................................................... 19
Optional Binding ................................................................................................................................... 20
7. SWIFT 4 – TUPLES .............................................................................................................. 21
8. SWIFT 4 – CONSTANTS ...................................................................................................... 22
Constants Declaration ........................................................................................................................... 22
Type Annotations .................................................................................................................................. 22
Naming Constants ................................................................................................................................. 23
Printing Constants ................................................................................................................................. 23
9.
SWIFT 4 – LITERALS ........................................................................................................... 24
Integer Literals ...................................................................................................................................... 24
Floating-point Literals ........................................................................................................................... 24
String Literals ........................................................................................................................................ 24
Boolean Literals..................................................................................................................................... 25
10. SWIFT 4 – OPERATORS ...................................................................................................... 26
Arithmetic Operators ............................................................................................................................ 26
Comparison Operators .......................................................................................................................... 27
iii