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

# decode(_:from:format:)

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

## Declaration

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

## 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

### Customizing Decoding

- [userInfo](foundation/propertylistdecoder/userinfo.md)
