<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSCoder/decodeValue(ofObjCType:at:size:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCoder(im)decodeValueOfObjCType:at:size:"
  },
  "title" : "decodeValue(ofObjCType:at:size:)"
}
-->

# decodeValue(ofObjCType:at:size:)

Decodes a single value of a known type from the specified data buffer.

```
func decodeValue(ofObjCType type: UnsafePointer<CChar>, at data: UnsafeMutableRawPointer, size: Int)
```

## Parameters

`type`

The Objective-C type to decode.

`data`

The data buffer to decode from.

`size`

The size of the data buffer.

## Discussion

The `type` parameter must contain exactly one type code, and the buffer specified by `data` must be large enough to hold the value corresponding to that type code. For information on creating an Objective-C type code suitable for `type`, see [`Type Encodings`](/documentation/Foundation/NSMethodSignature#Type-Encodings).

Subclasses must override this method and provide an implementation to decode the value. In your overriding implementation, decode the value into the buffer beginning at data.

This method matches an [`encodeValue(ofObjCType:at:)`](/documentation/Foundation/NSCoder/encodeValue(ofObjCType:at:)) message used during encoding.

---

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)