---
title: "decode(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/singlevaluedecodingcontainer/decode(_:)-4apkx"
---

# decode(_:)

Decodes a single value of the given type.

## Declaration

```swift
func decode(_ type: Int.Type) throws -> Int
```

## Parameters

- `type`: The type to decode as.

## Return Value

Return Value A value of the requested type.

## Discussion

Discussion note: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. note: DecodingError.valueNotFound if the encountered encoded value is null.
