Contents

CKShare.Metadata

An object that describes a shared record’s metadata.

Declaration

class Metadata

Overview

A share’s metadata is an intermediary object that provides access to the share, its owner, and, for a shared record hierarchy, its root record. Metadata also includes details about the current user’s participation in the share.

You don’t create metadata. CloudKit provides it to your app when the user taps or clicks a share’s url, such as in an email or a message. The method CloudKit calls varies by platform and app configuration, and includes the following:

Respond by checking the participantStatus of the provided metadata. If the status is pending, use CKAcceptSharesOperation to accept participation in the share. You can also fetch metadata independent of this flow using CKFetchShareMetadataOperation.

For a shared record hierarchy, the hierarchicalRootRecordID property contains the ID of the share’s root record. When using CKFetchShareMetadataOperation to fetch metadata, you can include the entire root record by setting the operation’s shouldFetchRootRecord property to true. CloudKit then populates the rootRecord property before it returns the metadata. You can further customize this behavior using the operation’s rootRecordDesiredKeys property to specify which fields to return. This functionality isn’t applicable for a shared record zone because, unlike a shared record hierarchy, it doesn’t have a nominated root record.

The participant properties provide the current user’s acceptance status, permissions, and role. Use these values to determine what functionality to provide to the user. For example, only display editing controls for accepted participants with readWrite permissions.

Topics

Accessing the Share

Accessing the Root Record

Accessing the Participant’s Capabilities

Initializers

See Also

Share Requests