<!--
{
  "availability" : [
    "iOS: 2.0.0 - 11.0.0",
    "iPadOS: 2.0.0 - 11.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.0.0 - 10.13.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSArchiver/archiverData",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSArchiver(py)archiverData"
  },
  "title" : "archiverData"
}
-->

# archiverData

The receiver’s archive data.

```
var archiverData: NSMutableData { get }
```

## Discussion

The returned data object is the same one specified as the argument to [`init(forWritingWith:)`](/documentation/Foundation/NSArchiver/init(forWritingWith:)). It contains whatever data has been encoded thus far by invocations of the various encoding methods. It is safest not to invoke this method until after [`encodeRootObject(_:)`](/documentation/Foundation/NSArchiver/encodeRootObject(_:)) has returned. In other words, although it is possible for a class to invoke this method from within its [`encode(with:)`](/documentation/Foundation/NSCoding/encode(with:)) method, that method must not alter the data.

---

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)