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.

https://developer.apple.com/forums/thread/820022

#swiftdata

SwiftData ModelContext Pollution wโ€ฆ | Apple Developer Forums

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)

#SwiftData #Swift #iOSDev

How to rename properties without losing data - a free SwiftData by Example tutorial

Learn Swift coding for iOS with these free tutorials

Hacking with Swift

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

#iosdev #swiftui #swiftdata

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

#iosdev #swiftdata

Understanding SwiftData VersionedSchema and Custom Migrations