Skip to content

Instantly share code, notes, and snippets.

@MuazzezA
Created August 11, 2023 12:19
Show Gist options
  • Save MuazzezA/10178ce3d5428a5d14b6d0eddad73231 to your computer and use it in GitHub Desktop.
Save MuazzezA/10178ce3d5428a5d14b6d0eddad73231 to your computer and use it in GitHub Desktop.
Simple code to understand the lifecycle of UIControllerView
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
print("view did load")
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
print("-----")
print("view will appear")
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
print("view did appear")
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
print("view will disappear")
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
print("view did disappear")
}
@IBAction func removeViewButtonAct(_ sender: Any) { // connect to button
print("-----")
print("remove view")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment