Page 4

Swift

Type Inference ..................................................................................................................................... 12

5.

SWIFT – VARIABLES .......................................................................................................... 14 Variable Declaration ............................................................................................................................ 14 Type Annotations ................................................................................................................................ 15 Naming Variables ................................................................................................................................ 15 Printing Variables ................................................................................................................................ 16

6.

SWIFT – OPTIONALS ......................................................................................................... 17 Forced Unwrapping ............................................................................................................................. 17 Automatic Unwrapping ....................................................................................................................... 18 Optional Binding.................................................................................................................................. 19

7.

SWIFT – CONSTANTS........................................................................................................ 21 Constants Declaration ......................................................................................................................... 21 Type Annotations ................................................................................................................................ 21 Naming Constants ............................................................................................................................... 22 Printing Constants ............................................................................................................................... 22

8.

SWIFT – LITERALS ............................................................................................................. 24 Integer Literals .................................................................................................................................... 24 Floating-point Literals .......................................................................................................................... 24 String Literals....................................................................................................................................... 25 Boolean Literals ................................................................................................................................... 26

9.

SWIFT – OPERATORS ........................................................................................................ 27 Arithmetic Operators........................................................................................................................... 27 Comparison Operators ........................................................................................................................ 28 Logical Operators ................................................................................................................................ 28 Bitwise Operators ................................................................................................................................ 29 iii

​Swift is just a effective and user-friendly programming language for macOS, iOS, watchOS and ...  

...

Advertisement