O'Reilly logo

Xcode 7 Essentials - Second Edition by Jayant Varma, Brett Ohland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Connecting views and controllers

We now have an app with two pages. While impressive, we haven't tapped into the real power of IB to connect our view and our controllers.

Subclassing UIViewController

When we created a new project using the Single View Application template, Xcode created a View and View Controller for us in the storyboard. This is the view on the canvas that we've been dragging buttons and labels onto.

Remember our discussion of an MVC application; the view that we see on the IB canvas is the V portion and Xcode created the C portion for you as a file called ViewController.swift.

Our newly created View Controller that was placed on the canvas is only a View; we need to specifically create the Controller and associate these two pieces ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required