3. Managed Object Model Migration

Anyone who has never made a mistake has never tried anything new.

Albert Einstein

In Chapter 2, “Managed Object Model Basics,” the fundamentals of managed object models were introduced, yet you were constrained to just one entity and a few attributes. The next logical step is to add to the model; however, this requires a number of preliminary steps to prevent errors caused by these changes. This chapter shows how to add model versions and model mappings, and it demonstrates different migration techniques you can choose when upgrading a model.

Changing a Managed Object Model

As an application evolves, its managed object model probably needs to change, too. Simple changes, such as attribute defaults, validation ...

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.