I was hoping for an update of SwiftData which adopted the use of shared and public CloudKit containers, in the same way it does for the private CloudKit container.
So firstly, a big request to any Apple devs reading, for this to be a thing!
Secondly, what would be a sensible way of adding a shared container in CloudKit to an existing app that is already using SwiftData?
Would it be possible to use the new DataStore method to manage CloudKit syncing with a public or shared container?
SwiftData + CloudKit public or shared database isn't supported today. If that is critical to your app, I suggest that you file a feedback report to voice your need.
The framework, including the new DataStore API, doesn't provide supports in that regard. You can choose to implement your own way, similar to what NSPersistentCloudKitContainer
does, but that will be obviously very involved.
I'd probably stick with NSPersistentCloudKitContainer
, if I do need the integration with CloudKit public or shared database.
Best,
——
Ziqiao Chen
Worldwide Developer Relations.