---
title: "init(coder:)"
framework: cloudkit
role: symbol
role_heading: Initializer
path: "cloudkit/ckshare/init(coder:)"
---

# init(coder:)

Creates a share from a serialized instance.

## Declaration

```swift
init(coder aDecoder: NSCoder)
```

## Parameters

- `aDecoder`: The coder to use when deserializing the share.

## Discussion

Discussion When saving a newly created CKShare, you must save the share and its rootRecord in the same CKModifyRecordsOperation batch.

## See Also

### Creating a Share

- [init(rootRecord:)](cloudkit/ckshare/init(rootrecord:).md)
- [init(rootRecord:shareID:)](cloudkit/ckshare/init(rootrecord:shareid:).md)
- [init(recordZoneID:)](cloudkit/ckshare/init(recordzoneid:).md)
