---
title: "decode(_:from:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/propertylistdecoder/decode(_:from:)"
---

# decode(_:from:)

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

## Declaration

```swift
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

Discussion If the data is not a valid property list, this method throws the DecodingError.dataCorrupted(_:) error. If a value within the property list fails to decode, this method throws the corresponding error.

## See Also

### Decoding

- [init()](foundation/propertylistdecoder/init().md)
