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 objects. And if you change just one object, you can update only that object. This incremental fetching, updating, deleting, and inserting can radically improve the performance of your application when you have a lot of model objects being shuttled between the filesystem and RAM.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.156.140