Navigating to a Photo

In this section, you are going to add functionality to allow a user to navigate to and display a single photo.

Create a new Swift file named PhotoInfoViewController. In this new file, declare the PhotoInfoViewController class and add an imageView outlet.

import Foundation
import UIKit

class PhotoInfoViewController: UIViewController {

    @IBOutlet var imageView: UIImageView!
}

Now set up the interface for this view controller. Open Main.storyboard and drag a new View Controller onto the canvas from the object library. With this view controller selected, open its identity inspector and change the Class to PhotoInfoViewController.

When the user taps on one of the collection view cells, the application will navigate ...

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.