<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKContainer/accept(_:completionHandler:)-7s3t7",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "s:So11CKContainerC8CloudKitE6accept_17completionHandlerySaySo15CKShareMetadataCG_ys6ResultOySDyAgJySo0G0Cs5Error_pGGsAM_pGctF"
  },
  "title" : "accept(_:completionHandler:)"
}
-->

# accept(_:completionHandler:)

Accepts the specified share metadatas.

```
@preconcurrency func accept(_ metadatas: [CKShare.Metadata], completionHandler: @escaping @Sendable (Result<[CKShare.Metadata : Result<CKShare, any Error>], any Error>) -> Void)
```

## Parameters

`metadatas`

The metadatas of the shares to accept.

`completionHandler`

The handler to execute when the process finishes.

## Discussion

The closure doesn’t return a value and takes the following parameters:

- A dictionary of fetched shares. The dictionary uses the metadatas you specify in `metadatas` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/Swift/Result> that contains either the corresponding fetched share, or an error that describes why CloudKit can’t fetch that share.

This method accepts shares asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of [`CKAcceptSharesOperation`](/documentation/CloudKit/CKAcceptSharesOperation) and configure it to use the necessary priority.

---

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)