Page 9

Swift

23.

SWIFT – SUBSCRIPTS ...................................................................................................... 123 Subscript Declaration Syntax and its Usage ....................................................................................... 123 Options in Subscript .......................................................................................................................... 125

24.

SWIFT – INHERITANCE ................................................................................................... 127 Base Class .......................................................................................................................................... 127 Subclass ............................................................................................................................................. 128 Overriding ......................................................................................................................................... 129 Methods Overriding .......................................................................................................................... 129 Property Overriding ........................................................................................................................... 130 Overriding Property Observers .......................................................................................................... 131 Final Property to prevent Overriding ................................................................................................. 132

25.

SWIFT – INITIALIZATION ................................................................................................. 135 Initializer Role for Stored Properties.................................................................................................. 135 Setting Property Values by Default .................................................................................................... 136 Parameters Initialization ................................................................................................................... 136 Local & External Parameters .............................................................................................................. 137 Parameters without External Names ................................................................................................. 138 Optional Property Types .................................................................................................................... 139 Modifying Constant Properties During Initialization .......................................................................... 140 Default Initializers ............................................................................................................................. 141 Memberwise Initializers for Structure Types ..................................................................................... 142 Initializer Delegation for Value Types ................................................................................................ 142 Class Inheritance and Initialization .................................................................................................... 144 Initializer Inheritance and Overriding ................................................................................................ 146 Failable Initializer .............................................................................................................................. 148 Failable Initializers for Enumerations ................................................................................................ 149 viii

​Quick is just a powerful and spontaneous programming language for macOS, iOS, watchOS and tvO...  

...

Advertisement