Swift
AnyObject.......................................................................................................................................... 189
30.
SWIFT – EXTENSIONS ..................................................................................................... 192 Computed Properties ........................................................................................................................ 192 Initializers .......................................................................................................................................... 193 Methods ............................................................................................................................................ 195 Mutating Instance Methods .............................................................................................................. 196 Subscripts .......................................................................................................................................... 196 Nested Types ..................................................................................................................................... 197
31.
SWIFT – PROTOCOLS...................................................................................................... 200 Property and Method Requirements ................................................................................................. 200 Mutating Method Requirements ....................................................................................................... 202 Initializer Requirements .................................................................................................................... 203 Class Implementations of Protocol Initializer Requirements .............................................................. 204 Protocols as Types ............................................................................................................................. 205 Adding Protocol Conformance with an Extension .............................................................................. 206 Protocol Inheritance .......................................................................................................................... 208 Class Only Protocols .......................................................................................................................... 210 Protocol Composition ........................................................................................................................ 211 Checking for Protocol Conformance .................................................................................................. 212
32.
SWIFT – GENERICS ......................................................................................................... 214 Generic Functions: Type Parameters ................................................................................................. 214 Extending a Generic Type .................................................................................................................. 216 Type Constraints ................................................................................................................................ 217 Associated Types ............................................................................................................................... 218 Where Clauses ................................................................................................................................... 220
33.
SWIFT – ACCESS CONTROL ............................................................................................. 223 x