Search Books

Hacking with Swift Project 12 - Saving User Data

Author Paul Hudson
📄 Viewing lite version Full site ›
🌎 Shop on Amazon — choose country
Price not listed
🛒 Buy New on Amazon 🇺🇸
Share:
Book Details
Author(s)Paul Hudson
ISBN / ASINB00S0GDPHG
ISBN-13978B00S0GDPH2
Sales Rank1,990,413
MarketplaceUnited States 🇺🇸

Description

Learn how to save user settings and data for later use.

This is our fourth technique project, and we're going to go back to project 10 and fix its glaring bug: all the names and faces you add to the app don't get saved, which makes the app rather pointless!

We're going to fix this using a new class called NSUserDefaults and a new protocol called NSCoding. We'll also be using the class NSKeyedUnarchiver that you just met in project 11, along with its counterpart: NSKeyedArchiver. Putting all these together, we're going to update project 10 so that it saves its people array whenever anything is changed, then loads when the app runs.