I've got the schema upgrade basically working, but I think I'd better move all the blobs out of it and into the file system.
Still, this is a good stable point to pause. I don't need to post a build of this. #SwiftData
I've got the schema upgrade basically working, but I think I'd better move all the blobs out of it and into the file system.
Still, this is a good stable point to pause. I don't need to post a build of this. #SwiftData
I've also been working on a Python script to pin/reset data. I'll post it in a few days, but here's a few things I've learned so far:
To show the top level of your repo:
git rev-parse --show-toplevel
To get the bundle ID of your project from there:
xcodebuild -showBuildSettings
(Search for PRODUCT_BUNDLE_IDENTIFIER =)
To get the simulator's container:
xcrun simctl get_app_container booted BUNDLE_ID data
From that directory, look in Library/Application Support. #SwiftData #Xcode
Thinking about how to update my SwiftData models so I don't need to change code everywhere. (This is in addition to my typealiases earlier.)
The rest of my code can just use notes. notesV1 can't be private because the migration needs to know about it, but it's new.
This seems safe, and if so very little code updating will be required.
Note: I am NOT changing the schema just to make these fields non-optional, but since I'm changing the schema anyway it seems a reasonable step. #SwiftData
So this should work, right?
enum SchemaV1 { /* includes Table */}
typealias CurrentSchema = SchemaV1
typealias Table = CurrentSchema.Table
โฆI had weird compiler errors with it last night, but I musta screwed it up because it's working great (so far) today.
The point is being able to update CurrentSchema to SchemaV2, etc. in the future and save fixing Table = SchemaV1.Table for all tables. #Swift #SwiftData
apparently it's a known issue and under investigation. For now, I'm going to namespace the model and move on.
Renaming a SwiftData property? Without @๐ด๐ก๐ก๐๐๐๐ข๐ก๐(๐๐๐๐๐๐๐๐๐๐๐๐:), lightweight migration treats old and new names as separate schema elements โ silently losing your data. A critical tip for anyone relying on auto-migration.
๐: https://www.hackingwithswift.com/quick-start/swiftdata/how-to-rename-properties-without-losing-data by Paul Hudson (@twostraws)
Running into a weird issue with #swiftdata I have two Schemas. Both schemas have a model named Item with slightly different properties.
SchemaA.Item and SchemaB.Item.
Attempting to save SchemaA.Item fails because it doesn't have a property defined on SchemaB.Item.
Each schema is only loaded and accessed from a ModelContainer that has no knowledge of the other schema.
Apple Doesnโt Show SwiftData iCloud Sync Status โ So Letโs Build One
https://azamsharp.com/2026/03/16/swiftdata-icloud-sync-status.html
Why Your SwiftData iCloud Sync is Not Working
https://azamsharp.teachable.com/courses/azamsharp-pro-for-all-content/lectures/64982224
If Youโre Not Versioning Your SwiftData Schema, Youโre Gambling
1. Understanding SwiftData VersionedSchema and Custom Migrations
https://azamsharp.teachable.com/courses/azamsharp-pro-for-all-content/lectures/64516360
2. Adding Unique Constraints in SwiftData Without Crashing Your App
https://azamsharp.teachable.com/courses/azamsharp-pro-for-all-content/lectures/64905664