April 2017
Intermediate to advanced
316 pages
9h 33m
English
Swift provides two special type aliases to work with non-specific types:
The Any and AnyObject type aliases must be used only when we explicitly require the behavior and capabilities that they provide. Being precise about the types we expect to work with in our code is a better approach than using the Any and AnyObject types as they can represent any type and pose dynamism instead of safety. Consider the following example:
class Movie { var director: String var name: String init(name: String, director: String) { self.director = director self.name = name } } let objects: ...Read now
Unlock full access