---
title: "decodeInt32(forKey:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nskeyedunarchiver/decodeint32(forkey:)"
---

# decodeInt32(forKey:)

Decodes a 32-bit integer value associated with a given key.

## Declaration

```swift
func decodeInt32(forKey key: String) -> Int32
```

## Parameters

- `key`: A key in the archive within the current decoding scope. key must not be nil.

## Return Value

Return Value The 32-bit integer value associated with the key key. Returns 0 if key does not exist.

## Discussion

Discussion If the archived value was encoded with a different size but is still an integer, the type is coerced. If the archived value is too large to fit into a 32-bit integer, the method raises an NSRangeException.

## See Also

### Related Documentation

- [encode(_:forKey:)](foundation/nskeyedarchiver/encode(_:forkey:)-5i7tc.md)

### Decoding Data

- [containsValue(forKey:)](foundation/nskeyedunarchiver/containsvalue(forkey:).md)
- [decodeDecodable(_:forKey:)](foundation/nskeyedunarchiver/decodedecodable(_:forkey:).md)
- [decodeTopLevelDecodable(_:forKey:)](foundation/nskeyedunarchiver/decodetopleveldecodable(_:forkey:).md)
- [decodeBool(forKey:)](foundation/nskeyedunarchiver/decodebool(forkey:).md)
- [decodeBytes(forKey:returnedLength:)](foundation/nskeyedunarchiver/decodebytes(forkey:returnedlength:).md)
- [decodeDouble(forKey:)](foundation/nskeyedunarchiver/decodedouble(forkey:).md)
- [decodeFloat(forKey:)](foundation/nskeyedunarchiver/decodefloat(forkey:).md)
- [decodeInt64(forKey:)](foundation/nskeyedunarchiver/decodeint64(forkey:).md)
- [decodeObject(forKey:)](foundation/nskeyedunarchiver/decodeobject(forkey:).md)
- [finishDecoding()](foundation/nskeyedunarchiver/finishdecoding().md)
- [decodingFailurePolicy](foundation/nskeyedunarchiver/decodingfailurepolicy.md)
