---
title: "accept(_:completionHandler:)"
framework: cloudkit
role: symbol
role_heading: Instance Method
path: "cloudkit/ckcontainer/accept(_:completionhandler:)-7s3t7"
---

# accept(_:completionHandler:)

Accepts the specified share metadatas.

## Declaration

```swift
@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

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 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 and configure it to use the necessary priority.
