Interacting with View Controllers and Their Views

Let’s look at some methods that are called during the lifecycle of a view controller and its view. Some of these methods you have already seen, and some are new.

  • init(coder:) is the initializer for UIViewController instances created from a storyboard.

    When a view controller instance is created from a storyboard, its init(coder:) gets called once. You will learn more about this method in Chapter 15.

  • init(nibName:bundle:) is the designated initializer for UIViewController.

    When a view controller instance is created without the use of a storyboard, its init(nibName:bundle:) gets called once. Note that in some apps, you may end up creating several instances of the same view controller ...

Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.