---
title: decodingFailurePolicy
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nscoder/decodingfailurepolicy-swift.property
---

# decodingFailurePolicy

The action the coder should take when decoding fails.

## Declaration

```swift
var decodingFailurePolicy: NSCoder.DecodingFailurePolicy { get }
```

## Discussion

Discussion A decode call can fail for the following reasons: The keyed archive data is corrupt or missing. A type mismatch occurs, such as expecting a class by calling decodeObject(of:forKey:) but encountering a numeric type instead. This also occurs when decodeInteger(forKey:) encounters a value encoded as floating-point, or vice versa. A secure coding violation occurs. This happens when you attempt to decode an object that doesn’t conform to NSSecureCoding. This also happens when the encoded type doesn’t match any of the types passed to decodeObject(of:forKey:).

## See Also

### Inspecting a Coder

- [allowsKeyedCoding](foundation/nscoder/allowskeyedcoding.md)
- [containsValue(forKey:)](foundation/nscoder/containsvalue(forkey:).md)
- [NSCoder.DecodingFailurePolicy](foundation/nscoder/decodingfailurepolicy-swift.enum.md)
