<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSItemProvider/registerCKShare(container:allowedSharingOptions:preparationHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So14NSItemProviderC8CloudKitE15registerCKShare9container21allowedSharingOptions18preparationHandlerySo11CKContainerC_So09CKAllowediJ0CSo0F0CyYaYbKctF"
  },
  "title" : "registerCKShare(container:allowedSharingOptions:preparationHandler:)"
}
-->

# registerCKShare(container:allowedSharingOptions:preparationHandler:)

Creates and registers a new collaboration object using a collection of records to share.

```
func registerCKShare(container: CKContainer, allowedSharingOptions: CKAllowedSharingOptions = CKAllowedSharingOptions.standard, preparationHandler: @escaping @Sendable () async throws -> CKShare)
```

## Parameters

`container`

A <doc://com.apple.documentation/documentation/CloudKit/CKContainer> the system uses to coordinate all the interactions between your app and the server.

`allowedSharingOptions`

The <doc://com.apple.documentation/documentation/CloudKit/CKAllowedSharingOptions>. The standard option is the default.

`preparationHandler`

The handler the system calls in your app to create a new <doc://com.apple.documentation/documentation/CloudKit/CKShare>.

## Discussion

Use this method to share a collection of <doc://com.apple.documentation/documentation/CloudKit/CKRecord> objects that don’t have an existing <doc://com.apple.documentation/documentation/CloudKit/CKShare> assignment. When the system calls the `preparationHandler`, your app creates a new `CKShare` with the appropriate root `CKRecord` or <doc://com.apple.documentation/documentation/CloudKit/CKRecordZone/ID>.

After the server successfully saves the share, invoke the <doc://com.apple.documentation/documentation/CloudKit/CKSharePreparationCompletionHandler> with either the resulting `CKShare`, or an `NSError` if the save fails.

When the system invokes the share sheet with a `CKShare` that you register with this method, it prompts the user to start sharing.

---

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)