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

# decode(_:from:)

Decode a decodable object from Data

## Declaration

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

## Parameters

- `type`: The type to decode into.
- `data`: The data to use for decoding

## Return Value

Return Value An instance of type T or throws an error if unable to decode.
