Programare swift Swift tutorial from tutorials point | Page 8

Swift 4 19. SWIFT 4 – CLOSURES ......................................................................................................... 87 Expressions in Closures ......................................................................................................................... 88 Single Expression Implicit Returns ......................................................................................................... 89 Known Type Closures ............................................................................................................................ 90 Declaring Shorthand Argument Names as Closures ............................................................................... 90 Closures as Operator Functions ............................................................................................................. 91 Closures as Trailers ................................................................................................................................ 91 Capturing Values and Reference Types ................................................................................................. 92 20. SWIFT 4 – ENUMERATIONS ............................................................................................... 94 Enumeration Functionality .................................................................................................................... 94 Enumeration with Switch Statement ..................................................................................................... 95 Difference between Associated Values and Raw Values........................................................................ 96 Enum with Associated Values ................................................................................................................ 96 Enum with Raw Values .......................................................................................................................... 97 21. SWIFT 4 – STRUCTURES ..................................................................................................... 98 Definition of a Structure ........................................................................................................................ 98 Accessing the Structure and its Properties ............................................................................................ 98 Best Usage Practices of Structures ...................................................................................................... 100 22. SWIFT 4 – CLASSES .......................................................................................................... 102 Class Identity Operators ...................................................................................................................... 104 23. SWIFT 4 – PROPERTIES .................................................................................................... 106 Stored Properties ................................................................................................................................ 106 Lazy Stored Property ........................................................................................................................... 107 Instance Variables ............................................................................................................................... 108 Computed Properties .......................................................................................................................... 108 vii