---
title: decodePortObject
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/nsportcoder/decodeportobject
---

# decodePortObject

Decodes and returns an NSPort object that was previously encoded with any of the general encode...Object: messages.

## Declaration

```occ
- (NSPort *) decodePortObject;
```

## Return Value

Return Value An NSPort object that was previously encoded with any of the general encode...Object: messages.

## Discussion

Discussion This method is primarily for use by NSPort objects themselves—you can always use decodeObject() to decode any object. NSPort invokes this method in its init(coder:) method so the appropriate kernel information for the port can be decoded. A subclass of NSPortCoder shouldn’t decode an NSPort by sending it an init(coder:) message. See Subclassing NSCoder for more information.

## See Also

### Encoding NSPort Objects

- [encodePortObject:](foundation/nsportcoder/encodeportobject:.md)
