<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.5.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSCoder/encodeNXObject:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCoder(im)encodeNXObject:"
  },
  "title" : "encodeNXObject:"
}
-->

# encodeNXObject:

Encodes an old-style object onto the coder.

```
- (void) encodeNXObject:(id) object;
```

## Discussion

No sharing is done across separate [`encodeNXObject:`](/documentation/Foundation/NSCoder/encodeNXObject:) invocations. Callers must have implemented an [`encode(with:)`](/documentation/Foundation/NSCoding/encode(with:)), which parallels the `write:` methods, on all of their classes that may be touched by this operation.

---

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)