Retrieving some pictures
Now, we are going to display some pictures that were taken on the chosen city. As you know, we can use a table view for it. But, for this scenario, Apple has something more appropriate called the collection view.
Create a new file in the ViewControllers
group called PicturesViewController.swift
. Start by creating a class that inherits from UICollectionViewController
:
import UIKit class PicturesViewController: UICollectionViewController {
This class will need a special nested class to store the pictures' information, as we need to keep the URL, the title, the pictures ID, and the local path where it is stored:
private class PhotoInfo { var title:String! var url:String! var localPath:String! var id:String! }
As properties, we ...
Get Swift 2 Blueprints 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.