<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKShare/Metadata",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "c:objc(cs)CKShareMetadata"
  },
  "title" : "CKShare.Metadata"
}
-->

# CKShare.Metadata

An object that describes a shared record’s metadata.

```
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`](/documentation/CloudKit/CKShare/url), such as in an email or a message. The method CloudKit calls varies by platform and app configuration, and includes the following:

- For a scene-based iOS app in a running or suspended state, CloudKit calls the <doc://com.apple.documentation/documentation/UIKit/UIWindowSceneDelegate/windowScene(_:userDidAcceptCloudKitShareWith:)> method on your window scene delegate.
- For a scene-based iOS app that’s not running, the system launches your app in response to the tap or click, and calls the <doc://com.apple.documentation/documentation/UIKit/UISceneDelegate/scene(_:willConnectTo:options:)> method on your scene delegate. The `connectionOptions` parameter contains the metadata. Use its <doc://com.apple.documentation/documentation/UIKit/UIScene/ConnectionOptions/cloudKitShareMetadata> property to access it.
- For an iOS app that doesn’t use scenes, CloudKit calls your app delegate’s <doc://com.apple.documentation/documentation/UIKit/UIApplicationDelegate/application(_:userDidAcceptCloudKitShareWith:)> method.
- For a macOS app, CloudKit calls your app delegate’s <doc://com.apple.documentation/documentation/AppKit/NSApplicationDelegate/application(_:userDidAcceptCloudKitShareWith:)> method.
- For a watchOS app, CloudKit calls the <doc://com.apple.documentation/documentation/WatchKit/WKExtensionDelegate/userDidAcceptCloudKitShare(with:)> method on your watch extension delegate.

Respond by checking the [`participantStatus`](/documentation/CloudKit/CKShare/Metadata/participantStatus) of the provided metadata. If the status is `pending`, use [`CKAcceptSharesOperation`](/documentation/CloudKit/CKAcceptSharesOperation) to accept participation in the share. You can also fetch metadata independent of this flow using [`CKFetchShareMetadataOperation`](/documentation/CloudKit/CKFetchShareMetadataOperation).

For a shared record hierarchy, the [`hierarchicalRootRecordID`](/documentation/CloudKit/CKShare/Metadata/hierarchicalRootRecordID) property contains the ID of the share’s root record. When using [`CKFetchShareMetadataOperation`](/documentation/CloudKit/CKFetchShareMetadataOperation) to fetch metadata, you can include the entire root record by setting the operation’s [`shouldFetchRootRecord`](/documentation/CloudKit/CKFetchShareMetadataOperation/shouldFetchRootRecord) property to <doc://com.apple.documentation/documentation/Swift/true>. CloudKit then populates the [`rootRecord`](/documentation/CloudKit/CKShare/Metadata/rootRecord) property before it returns the metadata. You can further customize this behavior using the operation’s [`rootRecordDesiredKeys`](/documentation/CloudKit/CKFetchShareMetadataOperation/rootRecordDesiredKeys-3xrex) 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

[`share`](/documentation/CloudKit/CKShare/Metadata/share)

The share that owns the metadata.

[`containerIdentifier`](/documentation/CloudKit/CKShare/Metadata/containerIdentifier)

The ID of the share’s container.

[`ownerIdentity`](/documentation/CloudKit/CKShare/Metadata/ownerIdentity)

The identity of the share’s owner.

### Accessing the Root Record

[`hierarchicalRootRecordID`](/documentation/CloudKit/CKShare/Metadata/hierarchicalRootRecordID)

The record ID of the shared hierarchy’s root record.

[`rootRecord`](/documentation/CloudKit/CKShare/Metadata/rootRecord)

The share’s root record.

[`rootRecordID`](/documentation/CloudKit/CKShare/Metadata/rootRecordID)

The record ID of the share’s root record.

### Accessing the Participant’s Capabilities

[`participantRole`](/documentation/CloudKit/CKShare/Metadata/participantRole)

The share’s participant role for the user who retrieves the metadata.

[`participantPermission`](/documentation/CloudKit/CKShare/Metadata/participantPermission)

The share’s permissions for the user who retrieves the metadata.

[`participantStatus`](/documentation/CloudKit/CKShare/Metadata/participantStatus)

The share’s participation status for the user who retrieves the metadata.

[`participantType`](/documentation/CloudKit/CKShareMetadata/participantType)

The share’s participation type for the user who retrieves the metadata.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)