---
title: encodedData
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nskeyedarchiver/encodeddata
---

# encodedData

The encoded data for the archiver.

## Declaration

```swift
var encodedData: Data { get }
```

## Discussion

Discussion If encoding has not yet finished, invoking this property calls finishEncoding() and populates this property with the encoded data. If you initialized the keyed archiver with init(forWritingWith:) and a specific mutable data instance, this property contains that instance.

## See Also

### Archiving Data

- [archivedData(withRootObject:requiringSecureCoding:)](foundation/nskeyedarchiver/archiveddata(withrootobject:requiringsecurecoding:).md)
- [finishEncoding()](foundation/nskeyedarchiver/finishencoding().md)
- [outputFormat](foundation/nskeyedarchiver/outputformat.md)
- [requiresSecureCoding](foundation/nskeyedarchiver/requiressecurecoding.md)
- [archivedData(withRootObject:)](foundation/nskeyedarchiver/archiveddata(withrootobject:).md)
- [archiveRootObject(_:toFile:)](foundation/nskeyedarchiver/archiverootobject(_:tofile:).md)
