9. Deep Copy

The only sure way to avoid making mistakes is to have no new ideas.

Albert Einstein

In Chapter 8, “Preloading Data,” importing default data from an XML file was demonstrated. This import method is suitable only when the XML source file is small enough to fit into memory. Another option is to use a prepopulated persistent store as the initial persistent store. If customers already have existing data and you want to add a lot more to it, this option isn’t suitable either. When you find yourself in this position, you may need to perform a “deep copy” of managed objects from a source persistent store to an existing persistent store. This option provides de-duplication and more granularity than the migratePersistentStore function of ...

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