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

# encode(_:)

Encodes a point.

```
func encode(_ point: NSPoint)
```

## Discussion

`NSCoder`’s implementation invokes [`encodeValue(ofObjCType:at:)`](/documentation/Foundation/NSCoder/encodeValue(ofObjCType:at:)) to encode `point`.

This method must be matched by a subsequent [`decodePoint()`](/documentation/Foundation/NSCoder/decodePoint()) message.

---

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)