# Lifecycle Overview
- Preparation if being segued to
- Outlet setting
- Appearing and disappearing
- Geometry (Orientation) changes
- Low-memory warning
# Lifecyle Methods
- func awakeFromNib()
> ALways call super.awakeFromNib()
> Sent to each object recreated from a nib archive, but only after all the objects in the archive have been loaded and initialized.
> At this point MVC is not yet loaded
- override func viewDidLoad()
> Always call super.viewDidLoad()
> Called when outlets are loaded so a good place to set up UI
> But the geometry (view's bounds) is not yet set so uncertain of iPhone size or iPad size. Do not do works about geometry here.
- func viewWillAppear(animated: Bool)
> Called when view is about to appear.
> Could happen a lot unlike viewDidLoad happens only once.
> Geometry data is available at this point.
- func viewDidAppear(animated: Bool)
> Called when view appeared
- override func viewWillDisappear(animated: Bool)
> Always call super.viewWillDisappear(animated)
> Clean up stuffs here
> Do not do too many clean-up works here. If required, then, use another thread to do works.
- func viewDidDisappear(animated: Bool)
> Called when view disappeared
- func viewWillLayoutSubViews() and func viewDidLayoutSubViews()
> Called when view's frame chages and its subviews is re-layed out, like autorotation case.
> Reset subviews or do geometry-related works here.
> Most of the time the autolayout handles geometry changes for you so you do not have to handle these 2 methods.
- func viewWillTransitionToSize(size: CGSize, transitoinCoord: UIViewControllerTransitionCoordinator)
> Called when screen rotation happens
> transitoinCoord provides a method to let you animate alongside the rotation animation.
- func didReceiveMemoryWarning()
> Called when memory available is low