O'Reilly logo

Learning Swift by Andrew J Wagner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Permanently saving a photo

Our app works pretty well to save pictures, but as soon as the app quits, all the photos are lost. We need to add a way to save the photos permanently. Our refactoring of the code allows us to work exclusively within PhotoStore now.

Before we write any code, we have to decide how we will store the photos permanently. There are many ways we could choose to save the photos, but one of the easiest ways is to save it to the filesystem, which is what we conceived in our conception phase. Every app is provided with a documents directory that is automatically backed up by the operating system as a part of normal backups. We can store our photos here as files named after the label the user gives them. To avoid any problems with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required