---
title: "decode(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/unkeyeddecodingcontainer/decode(_:)-83ekt"
---

# decode(_:)

Decodes a value of the given type.

## Declaration

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

## Parameters

- `type`: The type of value to decode.

## Return Value

Return Value A value of the requested type, if present for the given key and convertible to the requested type.

## Discussion

Discussion note: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. note: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode.
