Migration Questions CoreData to SwiftData

Hi,

I am looking to migrate a CoreData app which uses CloudKit to SwiftData and have two (for now) migration questions.

(1) Many of the attributes have the Optional checkbox checked in the xcdatamodeld file. The corresponding SwiftData properties are marked as Optional (?) but are never not initialized to an actual value. Can I remove the ? from those property types or am I required to do this as a migration?

(1a) If I'm required to do this as a migration, is this a custom migration or can I do it as a light migration.

(2) I have several Int16 in the Core Data model which I'd like to make Ints in the SwiftData model. Is this a migration? Is it a custom one or can the migration make the conversion.

Thank you,

Daniel

In playing further and watching past Core Data videos about migration I believe the answers are

(1) We can move from an optional type to a non-optional type in our SwiftData classes if we provide a default value.

(1a) No migration at all seems to be required or it is a light migration that is invisible to me

(2) Since I'm using CloudKit I can't change the types from Int16 to Int as I can't remove items from the CloudKit schema. It's not a big deal as I already used a computed property to convert from the Int the app uses to the Int16 the schema requires. Swift computed properties make this wrapping of types really easy to do.

Migration Questions CoreData to SwiftData
 
 
Q