I have a SwiftData + CloudKit app that is deployed to the Mac App Store.
As a diagram my situation looks like:
On my Mac, I have installed the App Store version of the App.
When developing it I run the app via Xcode, so I can have a debug build running.
The initial stable schema was deployed to CloudKit production before the App release.
Now, when I change the SwiftData schema again and run the Debug app on my Mac
What happens is that:
The SwiftData local store is on the latest schema
The CloudKit schema for development is automatically updated
That’s all good, but if I run the App Store app version of my app. By default, it uses the same SwiftData store for both builds of the app, which are being synced to different CloudKit schemas for development and production at the same time.
As a result, I get an unreliable state where I have seen data duplication as a result, or CloudKit syncing just breaks. Also, since I’m developing the app, the changes to the schema in development may not make it to production, so I don’t want to promote those changes to production.
So my question:
What’s the recommended way to evolve the schema for an app already on the App Store?
I haven’t seen any example or session from Apple that tackles this -what I consider common- use case.
I tried to have different CloudKit containers for a "Dev" and "Prod" builds, but that wasn’t the solution.
0
0
15