Post

Replies

Boosts

Views

Activity

Reply to Automatic lightweight migrations in SwiftData VersionedSchema?
I've experimented with it a bit and these are what I found out. There are no automatic lightweight migrations, you have to write every changes to your model in the migration If you do not create a lightweight migrations, your app will crash. CONCLUSION: If you have transitioned to a VersionedSchema, you now have to write every lchanges to your model in the migration or else your app will crash.
Dec ’24
Reply to How to Drop Entity in SwiftData and CloudKit?
Wow! Now I understand, thank you very much. This has been very insightful. Building up on the previous example, what could be possible causes why didMigrate is not being called? I wrote a print statement and some code, but it's never run. static let migrateV1toV2 = MigrationStage.custom( fromVersion: SchemaV1.self, toVersion: SchemaV2.self, willMigrate: nil, didMigrate: { context in print("Running Post Migration") // post-migration code here } ) My current workaround was to run the post-migration code outside the MigrationStage.
Jan ’25