<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKShare/init(coder:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "c:objc(cs)CKShare(im)initWithCoder:"
  },
  "title" : "init(coder:)"
}
-->

# init(coder:)

Creates a share from a serialized instance.

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

## Parameters

`aDecoder`

The coder to use when deserializing the share.

## Discussion

When saving a newly created [`CKShare`](/documentation/CloudKit/CKShare), you must save the share and its [`rootRecord`](/documentation/CloudKit/CKShare/Metadata/rootRecord) in the same [`CKModifyRecordsOperation`](/documentation/CloudKit/CKModifyRecordsOperation) batch.

---

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)