Question regarding viewWillAppear and Override Keyword

I heard the following in an online Swift course:

"The viewWillAppear function belongs to the UIViewController class. So for our ViewController, which subclasses UIViewController, we'll want to override it."

I have no idea of what the instructor's sentence means. I'm a beginner. Can someone please explain to me in beginner-friendly speech? I'm completely confused. Thank you.

You might find this section of the Swift book helpful to define concepts like class methods, overrides, and inheritance:

https://docs.swift.org/swift-book/LanguageGuide/Inheritance.html

1 Like

Okay, nevermind, a friend explained this to me. Thank you so much everyone. Please answer anyway in case someone else has the same question. Thank you.

I would add that study of the view-controller lifecycle would benefit any newcomer to iOS development, at least until SwiftUI attains world domination. :sweat_smile: My favorite lifecycle method is didReceiveMemoryWarning().

Terms of Service

Privacy Policy

Cookie Policy