'How do I fetch the other records that have references to the root record of a share in CloudKit?

I am able to fetch the share that a record is the root record of that share. In other words, I have a record, and that record is the root record of a share, and I fetch the CKShare object that shares that record. That record is the root record of the CKShare object.

I am able to fetch the CKShare.Metadata object of that CKShare object.

How do I find out what other records have references to that root record? It's not in the CKShare.Metadata. I know what record types in the shared database have references to the root record. Would I create a CKRecord.Reference object with an initializer then query for the record type that has those equivalent CKRecord.Reference objects in the respective field?

This seems like a lot of work. Is there an easier way to do this?



Sources

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

Source: Stack Overflow

Solution Source