Introducing CoreDataImporter

To create managed objects based on an XML file, you’ll need to map what data goes where. This process requires intimate knowledge of the application source data and destination model. For Grocery Dude, this is a straightforward process because the data model is simple. The principles used for Grocery Dude can be applied to more complicated data models. To keep CoreDataHelper as clear as possible, a new class called CoreDataImporter will be created. CoreDataImporter will contain generic methods used to import unique managed objects. The methods are generic so they can be used with any data model.

Before inserting a new object into the target context, a check will be performed to ensure the proposed object doesn’t ...

Get Learning Core Data for iOS: A Hands-On Guide to Building Core Data Applications 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.