Skip to content

Instantly share code, notes, and snippets.

@cristhianleonli
Last active September 30, 2018 22:24
Show Gist options
  • Save cristhianleonli/379333f3fb46b5f9091a1bec17a8ed29 to your computer and use it in GitHub Desktop.
Save cristhianleonli/379333f3fb46b5f9091a1bec17a8ed29 to your computer and use it in GitHub Desktop.
import UIKit
class ViewController: UIViewController {
override func loadViewIfNeeded() {
super.loadViewIfNeeded()
print(#line)
// Loads the view controller's view if it has not already been set.
}
override func loadView() {
super.loadView()
print(#line)
// This is where subclasses should create their custom view hierarchy if they aren't using a nib. Should never be called directly.
}
override func viewDidLoad() {
super.viewDidLoad()
print(#line)
// Called after the view has been loaded. For view controllers created in code, this is after -loadView. For view controllers unarchived from a nib, this is after the view is set.
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
print(#line)
// Called when the view is about to made visible. Default does nothing
}
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
print(#line)
// Called just before the view controller's view's layoutSubviews method is invoked. Subclasses can implement as necessary. The default is a nop.
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
print(#line)
// Called just after the view controller's view's layoutSubviews method is invoked. Subclasses can implement as necessary. The default is a nop.
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
print(#line)
// Called when the view has been fully transitioned onto the screen. Default does nothing
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
print(#line)
// Called when the view is dismissed, covered or otherwise hidden. Default does nothing
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
print(#line)
// Called after the view was dismissed, covered or otherwise hidden. Default does nothing
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment