April 2020
Intermediate to advanced
528 pages
15h 40m
English
Next you are going to create a custom UICollectionViewCell subclass to display the photos. While the image data is downloading, the collection view cell will display a spinning activity indicator using the UIActivityIndicatorView class.
Create a new Swift file named PhotoCollectionViewCell and define PhotoCollectionViewCell as a subclass of UICollectionViewCell. Then add outlets to reference the image view and the activity indicator view.
Listing 21.7 Creating the PhotoCollectionViewCell class (PhotoCollectionViewCell.swift)
import Foundationimport UIKit class PhotoCollectionViewCell: UICollectionViewCell { @IBOutlet var imageView: UIImageView! @IBOutlet var spinner: UIActivityIndicatorView! ...
Read now
Unlock full access