Sharing Core Data With CloudKit in SwiftUI | Kodeco, the new

Learn to share data between CoreData and CloudKit in a SwiftUI app.

This is a companion discussion topic for the original entry at

Do you have suggestion on a Multiplatform project (including macOS) how to replicate UICloudSharingController? UICloudSharingController is not available on Mac platform.

First of all, thank you for this very complete tutorial that works perfectly!

If it helps, during my dev I ran into this error with Xcode (currently in 14.3) to accept a share:

You need a newer version of AppName to open this item, but the required version was not found in the App Store.

Solution: In the Info file, add:
CKSharingSupported - Bool - YES

Another small detail, there is a warning in the createShare function in this line:
let (_, share, _) = try await stack.persistentContainer.share([destination], to: nil)

Non-sendable type β€˜CKShare?’ exiting main actor-isolated context in call to non-isolated instance method β€˜share(_:to:)’ cannot cross actor boundary

This does not prevent compilation but I was wondering if there is a solution to silence this warning?

Great tutorial, I found this really easy to follow and broken down in the sections helped me understand each element.

One issue I have noticed is that Read-Write permission is always granted when sharing for the first time, irrespective of what Sharing Option are set. Only when the user has accepted the invite can the owner change to View Only. Not sure if this is just a development environment issue.

1 Like