How to clear types?
✤ as? : Any -> T?
✤ as! : Any -> T
Slide 13
Slide 13 text
No content
Slide 14
Slide 14 text
No content
Slide 15
Slide 15 text
No content
Slide 16
Slide 16 text
WTF Immutability.
✤ Reference and Value types
✤ let - immutable name
✤ var - mutable name
Slide 17
Slide 17 text
Struct trickery
✤ How many objects will be created?
✤ How many times `print` will write?
✤ What `t1.b` will print?
Slide 18
Slide 18 text
Struct trickery
✤ 0. There is no objects.
✤ 1.
✤ 4.
Slide 19
Slide 19 text
Class trickery
✤ How many objects will be created?
✤ How many times `print` will write?
✤ What `t1.b` will print?
Slide 20
Slide 20 text
Class trickery
✤ 1
✤ 1
✤ -1
Slide 21
Slide 21 text
let == const?
Slide 22
Slide 22 text
let == const?
Slide 23
Slide 23 text
Value types Pros
✤ Immutable. Even with `var`
✤ `init` from compiler
✤ No inheritance
Slide 24
Slide 24 text
Properties
✤ no setter / getter methods.
✤ …unless `dynamic` is specified
✤ `willSet` / `didSet` with references to new/old values
✤ `public private(set) var …` is ok
Slide 25
Slide 25 text
enum vs NS_ENUM
Slide 26
Slide 26 text
enum vs NS_ENUM
Slide 27
Slide 27 text
Shadow types!
Slide 28
Slide 28 text
No content
Slide 29
Slide 29 text
No content
Slide 30
Slide 30 text
When use enum?
✤ Flags
✤ States
✤ Options
✤ Shadow type
Slide 31
Slide 31 text
Alamofire vs AFNetworking
Slide 32
Slide 32 text
Namespaces
✤ Nested types
✤ Frameworks
✤ Targets
Slide 33
Slide 33 text
Nested types
Slide 34
Slide 34 text
Nested types
Slide 35
Slide 35 text
Nested types
Slide 36
Slide 36 text
Nested types
Slide 37
Slide 37 text
Nested types
Slide 38
Slide 38 text
let = vs dispatch_once
Slide 39
Slide 39 text
Outro
✤ Run away from Obj-C
✤ Build your own logic modules
✤ Use Value Types
✤ Don’t use generics + inheritance + UIKit