viewWillAppear
override func viewDidLoad() {
super.viewDidLoad()
}
What is content view?
→ When you create a new view controller (cocoatoach class) in your storyboard, a View object is created automatically. The content view aforementioned is this.
viewWillAppear
override func viewWillAppear(_ animated: Bool){
super.viewWillAppear(animated)
}
→ Doesn't necessarily mean that it will "appear" in the screen as you can call view.isHidden = true sometimes.
→ This method is called everytime we come back to the View Controller.
→ viewDidLoad only gets called once because it is called when it is stacked in the navigation controller memory.
viewDidAppear
override func viewDidAppear(_ animated: Bool){
super.viewDidAppear(animated)
}
→ You might want to configure animations in this method. Animations might start a little bit too soon if you put animation related code in viewWillAppear or viewDidLoad.
viewWillDisappear
override func viewWillDisappear(_ animated: Bool){
super.viewWillDisappear(animated)
}
→ Often used when you want to save some sort of data right before the user dismisses the view.
viewDidDisappear
override func viewDidDisappear(_ animated: Bool){
super.viewDidDisappear(animated)
}