Chapter 13. ViewControllers in depth
This chapter covers
- Inheritance
- Override
- ViewController lifecycle
You’ve created several apps now and in each app you’ve had a ViewController. What exactly is a ViewController, anyway? The name definitely gives away a lot: it’s the code that controls the view that you created. We’re going to go more in depth now and look at the details of the ViewController, which means we’ll need to talk about some new programming concepts as well. This chapter includes some underlying programming principles, so make sure you understand it before you move on to the next chapter.
I know you may be excited here because you think you may get money from an inheritance, but in this case, it means something different—sorry. Please keep reading anyway, though. Let’s start by going back to Xcode and looking at the ViewController file. You’ll need to be familiar with ViewControllers in your programming career, so it’s important that you get comfortable with them. You can either look at one of the ViewControllers that you used in a previous app that you wrote or you can create a new app so you can look at it. Either way, in Xcode, click the ViewController.Swift in your Project Navigator tab (the leftmost tab).