Follow along at https://www.hackingwithswift.com/100/32.
This day resolves around recapping the content covered while going through Projects 4-6 in Hacking with Swift. I won't try to rehash what I wrote up already, but a few additional tidbits are noteworthy:
-
Whenever we're creating views in code — instead of with storyboards — overriding our view controller's
loadView
function is often the place to do it. For that matter, it's worth knowing aboutUIViewController
's view loading lifecycle as a whole:loadView
viewDidLoad
viewWillAppear
viewDidAppear
viewWillDisappear
viewDidDisappear
viewWillLayoutSubviews
viewDidLayoutSubviews
The
UIViewController
docs have more on all of these — as well as this handy graph: -
Auto Layout in code:
- VFL is cool
- Anchors are cool — and usually a lot more useful.
UIStackView
is another important part of this paradigm — but also a much larger topic 🙂.