NSPersistentCloudKitContainer: Exclude Relationship From Share

I am trying to add CloudKit sharing to my app using the new iOS 15 share method 

https://developer.apple.com/documentation/coredata/nspersistentcloudkitcontainer/3746834-sharemanagedobjects

In the app there are 3 core data entities (Folder, Item, Comment) with the following relationships:

Folder contains many Items

An Item has many Comments

I want to use CloudKit to share just the Item entity, not any of its relationships. Is this possible to do with the share(_:to:completion:) method? Currently, when I pass an Item to the share method it also includes the Folder and Comments in the CKShare. How do I prevent this?


A similar question was posted here with no response: https://developer.apple.com/forums/thread/697630

I would also like this information as I’m not sure my idea would work, but try this and get back to me if you find a way to do this. Create a func in your persistence file that removes relationships from your entity and then executes the share(_:to:completion:).

NSPersistentCloudKitContainer: Exclude Relationship From Share
 
 
Q