UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SwiftData What is this parameter in ModelConfiguration?

Forums > Swift

Does anybody know what the following parameter sharedAppContainerIdentifier is and how it is set up?

let modelconfiguration = ModelConfiguration(
    schema: Schema([Item.self]),
    sharedAppContainerIdentifier:nil,   // <------- here
    cloudKitContainerIdentifier: "..."


It's now called groupContainer and is a ModelConfiguration.GroupContainer.

See: https://developer.apple.com/documentation/swiftdata/modelconfiguration/groupcontainer-swift.enum

Pretty sure this is for groups of apps: e.g., you make Pages and Numbers and want people to use data in both programs.


Thanks, was the initializer changed?

Do you know if SwiftData supports icloud share?


hi @sheldor,

i don't see any reference to the change from sharedAppContainerIdentifier to groupContainer in the release notes for Xcode 15 beta 6; but this is not unusual. and documentation always lags for beta software.

as for the cloud, yes, SwiftData does support cloud sharing across devices logged into the same Apple ID.

  • it seems that once the proper cloud entitlements have been added your project and/or a CloudKit container is specified, you get a behind-the-scenes promotion from using NSPersistentContainer to NSPersistentCloudKitContainer in the underlying Core Data stack.

but even here, we're still in beta. there seems to be some uncertainty after moving to beta 6 about whether a persistent model's properties must all be marked as optional to work with the cloud ... and beta 6 changed the way that default values are specified in a persistent model (since the cloud has no notion of default values).

so, stay tuned for beta 7 and watch the Apple Developer's Forum on this. beta 7 will probably be here in about week ... or maybe sooner ... or maybe not.

hope that helps,



Thank you! :)

To this: "as for the cloud, yes, SwiftData does support cloud sharing across devices logged into the same Apple ID."

I meant whether SwiftData also supports sharing between different AppleIDs? So working together on data with CKShare.



(sorry @sheldor, just assumed you were asking about the low-hanging fruit of sharing across personal devices ...)

i don't think there are many examples or much documentation right now for CloudKit sharing with SwiftData. but there are suggestions in the WWDC videos that SwiftData will support multiple store configurations, which is probably what you'd need for CloudKit sharing (one config for the private database, one config for the shared database), since that's how NSPersistentCloudKitContainer sort of works for cloud sharing.

there's not much more i can say right now, but i am very interested in using SwiftData with multiple configurations (a recent Core Data project i worked on required such an approach).

hope that helps,



Thanks. I think then i have to wait a bit to see if there are any new tutorials on this topic


Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.