Intermediate Swift Session 403 Playground
In session 403 — Intermediate Swift, Brian Lanier and Joe Groff build upon the previous session introducing more in depth use of optionals, memory, init, closures, and pattern matching.
Some highlights include:
- optional binding directly to variables from the function.
- optional chaining for deeply nested optional values
- unowned reference types for dependent back references
- memberwise structure initialization
- convenience vs. designated initializers in swift
- lazy properties delay initialization until they are called
- deinit is available for classes that need it, i.e. to remove observers and the like
- Implicit returns and arguments for closures
- breaking strong reference cycles in closures using capture lists e.g. [unowned self]
- pattern matching in switch statements
- type patterns and the fallthrough statement
- switch using tuple pattern and the where statement to quickly validate a structure