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

# accept(_:completionHandler:)

Accepts the specified share metadata.

## Declaration

```swift
func accept(_ metadata: CKShare.Metadata, completionHandler: @escaping @Sendable (CKShare?, (any Error)?) -> Void)
```

## Parameters

- `metadata`: The metadata of the share 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: The corresponding share, or nil if CloudKit can’t accept the metadata. An error if a problem occurs, or nil if CloudKit successfully accepts the metadata.

## See Also

### Accessing Container Metadata

- [fetchShareMetadata(with:completionHandler:)](cloudkit/ckcontainer/fetchsharemetadata(with:completionhandler:).md)
- [CKAccountChanged](foundation/nsnotification/name-swift.struct/ckaccountchanged.md)
