'How to use sharing with CoreData/CloudKit synching

I have an app that works well synchronizing the local core data records with a private database. I would like to make the CloudKit database a shared database and then selectively share records with users. Is this even possible.

In other words, I'd like to continue having the Core Data/CloudKit sync working, but with the records that get synched limited to the user's share(s).

Does anyone have examples or a link to a discussion of this?



Solution 1:[1]

Apple solved this last year at WWDC21

Here is a link to the video

https://developers.apple.com/videos/play/wwdc2021/10015/

and some useful example code:

https://github.com/delawaremathguy/CoreDataCloudKitShare

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 iphaaw