Post

Replies

Boosts

Views

Activity

Reply to Added new field to swiftdata model, now crashes
Reply to self: I used custom and now it works static let migrateV1toV2 = MigrationStage.custom( fromVersion: SchemaV1.self, toVersion: SchemaV2.self, willMigrate: nil, didMigrate: nil ) static let migrateV2toV3 = MigrationStage.custom( fromVersion: SchemaV2.self, toVersion: SchemaV3.self, willMigrate: nil, didMigrate: nil ) What I need tho, is a way to completly clear the stores and create a new model structure because I completely changed my models and know nothing is working
Oct ’23
Reply to Lightweight Migration Issues
I never use the lightweight migration because it does not work for me, never. I always use custom with willMigrate: nil and didMigrate: nil static let migrateV1toV2 = MigrationStage.custom( fromVersion: SchemaV1.self, toVersion: SchemaV2.self, willMigrate: nil, didMigrate: nil ) static let migrateV2toV3 = MigrationStage.custom( fromVersion: SchemaV2.self, toVersion: SchemaV3.self, willMigrate: nil, didMigrate: nil )
Oct ’23
Reply to swiftData slow with large data
SwiftData as far as I know is a local SQLite database. If you call @Query it does load what you specified. I can not say if it loads ALL data at once, I think it does, tho I hope it uses some clever indexing under the hood. Custom indexing is currently not available in SwiftData. If you want to work with the data, (generate graphs), I would async that. If you want to list the data, try paging and only load x entries. For know SwiftData seems not build for big data batches.
Oct ’23