Saving Images to Disk

Although the Photo entities are being persisted, the image data associated with each photo is not. Large blobs of data, such as an image, should not be stored in Core Data due to performance concerns. Instead, you should store data like this on the filesystem.

For the image data, you will use the same approach that you used in your Homepwner application. In fact, you will use the same ImageStore class that you wrote for that project.

Open Homepwner.xcodeproj and drag the ImageStore.swift file from the Homepwner application to the Photorama application. Make sure to choose Copy items if needed. Once the ImageStore.swift file has been added to Photorama, you can close the Homepwner project.

Back in Photorama ...

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.