Please note, this blog entry is from a previous course. You might want to check out the current one.
View Controller Lifecycle
- viewDidLoad is called after instantiation and outlet setting (geometry is not set yet!) – use for setup
- viewWillAppear is called before the view appears on screen (geometry is available) – use for layout setup and updates which happened while the view was off screen
- viewDidAppear
- viewWillDisappear – use for cleaning up and saving states
- viewDidDisappear
Geometry changed
viewWillLayoutSubviews and viewDidLayoutSubviews can be used to adjust layouts in addition to autolayout.
viewWillTransitionToSize allows animations alongside the rotation animation from autolayout.
Autolayout
Autolayout provides provides the means to layout items for different view sizes. Size classes provide allow different autolayouts depending on the device types.
The lecture and its slides are available via iTunes named “8. View Controller Lifecycle, Autolayout”. The code for the psychologist demo is available on GitHub and at Stanford. The code for the autolayout demo is available on GitHub and at Stanford. The code for the ShowSizeClass demo is available at Stanford.
I updated to the newest version of Swift and when I try “extension User {}” I get an error “declaration is only valid at file scope”
Any ideas why?
Never mind, figured it out
Can anyone describe in detail what’s going on in User.swift ?
I am trying to understand it but can’t understand how he created the database dictionary?
How is he validating the login text?
And why struct is chosen over class?