Understanding everything about UIViewController
UIViewController is a core class in iOS development and behaves as a building block for most iOS apps that use UIKit.
UIViewController has multiple roles in iOS development:
- It is the C in the MVC pattern: If the UIView is the V (View) and our model is the M, the UIViewController is the one that coordinates between the presentation layer and the business layer. That role affects many of the features UIViewController has, such as life cycle events and memory management functions.
- Handling life cycle events: We explained this role of UIViewController in the previous section. UIViewController has another function: to manage the various life cycle events on the screen. By creating subclasses of UIViewController, we can take advantage of its different methods to handle all stages of a screen’s life cycle.
- Leading player in the navigation system: We can present UIViewController above another UIViewController or push...