Programare swift Swift tutorial from tutorials point | Page 9
Swift 4
Local and Global Variables .................................................................................................................. 111
Type Properties ................................................................................................................................... 111
Querying and Setting Properties ......................................................................................................... 112
24. SWIFT 4 – METHODS ....................................................................................................... 113
Instance Methods ............................................................................................................................... 113
Local and External Parameter Names .................................................................................................. 114
External Parameter Name with # and _ Symbol .................................................................................. 115
Self property in Methods .................................................................................................................... 116
Modifying Value Types from Instance Methods .................................................................................. 117
Self Property for Mutating Method ..................................................................................................... 118
Type Methods ..................................................................................................................................... 118
25. SWIFT 4 – SUBSCRIPTS..................................................................................................... 120
Subscript Declaration Syntax and its Usage ......................................................................................... 120
Options in Subscript ............................................................................................................................ 122
26. SWIFT 4 – INHERITANCE .................................................................................................. 124
Base Class ............................................................................................................................................ 124
Subclass .............................................................................................................................................. 125
Overriding ........................................................................................................................................... 126
Methods Overriding ............................................................................................................................ 126
Property Overriding ............................................................................................................................ 127
Overriding Property Observers ............................................................................................................ 128
Final Property to prevent Overriding ................................................................................................... 129
27. SWIFT 4 – INITIALIZATION ............................................................................................... 131
Initializer Role for Stored Properties ................................................................................................... 131
Setting Property Values by Default ..................................................................................................... 132
viii