UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

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.

2      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.