'How do I fetch or query shares from a database in CloudKit?

I was able to query records from CloudKit, but the CKRecord objects I retrieved were not able to cast to CKShare. How else would I retrieve shares in CloudKit. The cloudkit.share record type is not queryable.

This post on stackoverflow has an answer that says to take the share property of the CKRecord object, but Apple's CloudKitShare sample project found here uses code that casts CKRecord objects to CKShare.



Sources

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

Source: Stack Overflow

Solution Source