Next, you will create a Photo class to represent each photo that is returned from the web service request. The relevant pieces of information that you will need for this application are the id, the title, the url_h, and the datetaken.
Create a new Swift file called Photo and declare the Photo class with properties for the photoID, the title, and the remoteURL. Finally, add a designated initializer that sets up the instance.
import Foundation class Photo { let title: String let remoteURL: URL let photoID: String let dateTaken: Date init(title: String, photoID: String, remoteURL: URL, dateTaken: Date) { self.title = title self.photoID = photoID self.remoteURL = remoteURL self.dateTaken = dateTaken } }
You will use this class shortly once you are parsing the JSON data.