BLACK FRIDAY: Save 50% on all our Swift books and bundles! >>

Lightweight CoreData Migration with CloudKit

Forums > Swift

Does Core Data handle simple data-model additions like a new attribute w/out any further "help" from me? In my case, I have an app that uses Core Data for varius things related to a users profile. I have an existing data-model entity called Profile that I want to add 2 new attributes to:

hasPublished: Boolean lastDetail: String

Looking at the tutorial here at: Adding Core Data Entity Relationships

I see it say\s:

The magic of NSPersistentContainer is that it automatically configures Core Data to perform a lightweight migration if it’s needed and if it’s possible – that is, if the changes are small enough to be figured out by the system. So, as long as your changes are strictly additive, NSPersistentContainer will take care of all the work. Awesome, right?

So, does this cover my case? I'm not re-naming anything, just adding.

One more caveat, I'm using a NSPersistentCloudKitContainer as info can be shared across the users devices.


Save 50% in my Black Friday sale.

SAVE 50% This Black Friday all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.