** Take over the tricks from your parents. ** **
ViewController.swift
//Inherit UIViewController
class ViewController: UIViewController {
//Use UIViewController methods
override func viewDidLoad() {
//super is the parent class
super.viewDidLoad()
}
First, it inherits the class of UIViewController
.
This allows you to use the tricks that UIViewController has. If you right-click on the UIViewController
part and select ** Jump to Definition **, you'll see a list of tricks (yes, methods), but viewDidLoad
is also in it.
You can inherit the trick of "swinging down the sword" from the parent class and add the action of "jumping" to it (override) to arrange the trick in your own way.
Recommended Posts