super keyword do in Swift?<p>The <code>super</code> keyword calls a method or property from the parent class. It lets a child class use or extend the behavior of its parent.</p>super when overriding a method?Calling super ensures the parent class's original behavior runs. This keeps important setup or logic intact while adding new behavior.
super.viewDidLoad() in a UIViewController subclass?override func viewDidLoad() {
super.viewDidLoad()
// Your code here
}This calls the parent viewDidLoad() to keep default setup.
super in an overridden initializer?Not calling super.init() can cause your object to be incomplete or crash because the parent class's setup is skipped.
super in a method that is not overridden?No. You can only call super inside a method that overrides a parent method. Otherwise, the compiler will give an error.
super.method() in Swift?Calling super.method() runs the parent class's method, preserving its behavior.
viewDidLoad() in a UIViewController subclass but do NOT call super.viewDidLoad()?Not calling super.viewDidLoad() skips important setup done by the parent, which can cause unexpected behavior.
super in a method that does not override a parent method?You can only call super inside methods that override a parent method.
Calling super.init() runs the parent class's initializer to set up inherited properties.
The keyword super accesses the parent class's methods and properties.
super when overriding methods in Swift.super.init() in a subclass initializer.