The Action-Packed View Controller

Now that you’ve developed a working user interface, you can jump into the action: weaving UI elements like buttons and image views into the game logic. In this section, you’ll learn how to represent UI elements as resources in the view controller class. As you write class methods to change the resources, making pictures and text appear, the game will spring to life.

Click the tuxedo icon near the upper-right corner of Xcode to enter a side-by-side view. The main storyboard featuring the UI appears on the right. An editor panel appears on the left, showing the default code for the controller class:

import UIKitclass ViewController: UIViewController {    override func viewDidLoad() ...

Get Learning Swift™ Programming 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.