<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 8.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/PropertyListDecoder/decode(_:from:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation19PropertyListDecoderC6decode_4fromxxm_AA4DataVtKSeRzlF"
  },
  "title" : "decode(_:from:)"
}
-->

# decode(_:from:)

Returns a value of the specified type by decoding a property list using the default property list format.

```
func decode<T>(_ type: T.Type, from data: Data) throws -> T where T : Decodable
```

## Parameters

`type`

The type of the value to decode from the supplied property list.

`data`

The property list to decode.

## Discussion

If the data is not a valid property list, this method throws the <doc://com.apple.documentation/documentation/Swift/DecodingError/dataCorrupted(_:)> error. If a value within the property list fails to decode, this method throws the corresponding error.

---

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)