22 Core Data
When deciding between approaches to saving and loading for iOS applications, the first question is “Local or remote?” If you want to save data to a remote server, you will likely use a web service. If you want to store data locally, you have to ask another question: “Archiving or Core Data?”
Your LootLogger application leveraged the Codable APIs along with a PropertyListEncoder to serialize your data so it could be persisted to the filesystem. The biggest drawback to that mode of archiving is its all-or-nothing nature: To access anything in the archive, you must deserialize the entire file, and to save any changes, you must serialize the entire file.
Core Data, on the other hand, can fetch a subset of the stored ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access