Quick is just a effective and intuitive development language for macOS, iOS, watchOS and tvOS....

Page 11

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


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.