---
title: "unarchiver(_:didDecode:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nskeyedunarchiverdelegate/unarchiver(_:diddecode:)"
---

# unarchiver(_:didDecode:)

Informs the delegate that a given object has been decoded.

## Declaration

```swift
optional func unarchiver(_ unarchiver: NSKeyedUnarchiver, didDecode object: consuming Any?) -> Any?
```

## Parameters

- `unarchiver`: An unarchiver for which the receiver is the delegate.
- `object`: The object that has been decoded. object may be nil.

## Return Value

Return Value The object to use in place of object. The delegate can either return object or return a different object to replace the decoded one. In apps using ARC, the delegate should only return nil if object itself is nil. In apps not using ARC, the delegate can return nil to indicate that the decoded value is unchanged—that is, object will be decoded.

## Discussion

Discussion This method is called after object has been sent init(coder:) and awakeAfter(using:). The delegate may use this method to keep track of the decoded objects.

## See Also

### Decoding Objects

- [unarchiver(_:cannotDecodeObjectOfClassName:originalClasses:)](foundation/nskeyedunarchiverdelegate/unarchiver(_:cannotdecodeobjectofclassname:originalclasses:).md)
- [unarchiver(_:willReplace:with:)](foundation/nskeyedunarchiverdelegate/unarchiver(_:willreplace:with:).md)
