Skip to main content
0 votes
0 answers
75 views

Have I messed up my Swift Data Versioned Schema?

I have 5 Swift Data models: SDPlanBrief, SDAirport, SDChart, SDIndividualRunwayAirport, SDLocationBrief I went live with my first release of the app, with no migration plan or versioned schemas. ...
Paul Wilson's user avatar
0 votes
0 answers
54 views

SwiftData Migration Plan for deleting a Model no longer need, iCloud Sync is enabled

I don't know how do I write a migration plan for this if it's required, is this a lightweight migration or a complex migration @Model class ParkModel { var items: [String]? init(items: [...
Nishant Minerva's user avatar
5 votes
0 answers
642 views

SwiftData Custom Migration Always Fails - Possible Bug in SwiftData

I'm using SwiftData in my SwiftUI iOS app, and I need to implement a MigrationPlan before launching, so things go smoothly later when I need to make changes to the data being saved. For example, ...
pez's user avatar
  • 4,327
3 votes
1 answer
214 views

Do we need to copy unchanged models to new versioned schema in SwiftData during migration?

Question with sample code: We have two Swift Data models in VersionedSchemaV1 and want to add one optional field in one of the model in next app version. Shall we copy only changed model to ...
Navin Samuel's user avatar
1 vote
0 answers
192 views

SwiftData: Failed to create ModelContainer when Migrating

My app crashes at startup when trying to create SwiftData ModelContainer after creating a migration state from V1 to V2. This is the error I receive: Thread 1: Fatal error: Failed to create ...
Robert Basamac's user avatar
0 votes
0 answers
86 views

Combine NSPredicate and SwiftData Predicate for iOS AppIntent (Shortcuts) EntityPropertyQuery

Happy New Year, all! I'm trying to migrate my CoreData app to SwiftData. Prior to the migration, the Siri Shortcut's EntityPropertyQuery worked just fine, but now I'm struggling how to combine the [...
zkvvoob's user avatar
  • 496
0 votes
1 answer
510 views

SwiftData: adding a UUID to an existing model always creates the same id

I have a problem updating a SwiftData model by adding a property. Specifically, I have the following model and I am trying to update it by adding an id. The problem is that, if I do this, all records ...
Prec99's user avatar
  • 39
1 vote
0 answers
185 views

SwiftData - Cannot use staged migration with an unknown coordinator model version

I'm having trouble with my first migration using SwiftData - it's pretty simple, just adding a new var into the class. Here's the v1 model: import Foundation import SwiftData @Model final class ...
Doug Idle's user avatar
2 votes
0 answers
164 views

Adding a inverse relationship to already existing One-To-Many

My problem is: I already have a One-To-Many relationship. I just didn't implement the reverse property in the Many part, bc I didn't need it at the time. Now I do and here comes the problems. Those ...
nico_p2000's user avatar
1 vote
0 answers
116 views

SwiftData migration with iCloud and multi-device support

I’m writing test apps using SwiftData. Running migrations locally works fine. But I couldn’t find anything on how to handle a situation, where my local app is running on e.g. ‘MigrationSchemaV2’ and ...
MatFetsch's user avatar
3 votes
3 answers
2k views

SwiftData Versioning "Cannot use staged migration with an unknown coordinator model version."

I've started developing app with SwiftData and decided to move to VersionedSchema recently and it just fails when I try to add a new version of a schema with Code=134504 "Cannot use staged ...
Aleks Kuznetsov's user avatar
-2 votes
1 answer
204 views

SwiftData - how to correctly update application when SwiftData Model(s) change?

would anybody be so kind to provide a link or "steps to follow" that need to be done when you change a model and you want the updated app releases not to crash? Whenever I make a change to ...
matyasl's user avatar
  • 539
1 vote
0 answers
464 views

SwiftData can't initialize model container with error "The model used to open the store is incompatible with the one used to create the store"

I'm encountering an issue where my app crashes when users update to a new version. I reproduced the error locally and basically it happens when I run the app with the new stored field added to the ...
Yury Kaspiarovich's user avatar