I want to store the users preference in CloudKit attached to the users public User record. The preference can be either a private record or a shared record (shared by some other user).
Can I use CKReference to store a reference to the shared record, and if so how do I determine whether the stored CKReference is referring to the private or the public database ?
Currently if I store a CKReference to a private record then I am able to query the private database to retrieve the record but if I store a CKReference to the shared record then how can I determine which database to query.
Can I use a CKReference to link across databases or must I use something like record name to search for it and also store a separate reference to indicate whether it is a private or shared record ?
EDIT:
OK, it pays to read the documentation but it took a while to find the explanation I needed, here is the excerpt from the docs
You might also use record IDs is when you cannot use a CKReference object to refer to a record. References are only valid within a single zone of a database. To refer to objects outside of the current zone or database, save the strings in the record’s CKRecordID and CKRecordZoneID objects. When you want to retrieve the record later, use those strings to recreate the record and zone ID objects so that you can fetch the record.
https://developer.apple.com/documentation/cloudkit/ckrecordid
OK, it pays to read the documentation but it took a while to find the explanation I needed, here is the excerpt from the docs
You might also use record IDs is when you cannot use a CKReference object to refer to a record. References are only valid within a single zone of a database. To refer to objects outside of the current zone or database, save the strings in the record’s CKRecordID and CKRecordZoneID objects. When you want to retrieve the record later, use those strings to recreate the record and zone ID objects so that you can fetch the record.
https://developer.apple.com/documentation/cloudkit/ckrecordid