<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIViewController/decodeRestorableState(with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIViewController(im)decodeRestorableStateWithCoder:"
  },
  "title" : "decodeRestorableState(with:)"
}
-->

# decodeRestorableState(with:)

Decodes and restores state-related information for the view controller.

```
func decodeRestorableState(with coder: NSCoder)
```

## Parameters

`coder`

The coder object to use to decode the state of the view.

## Discussion

Do not call this method directly. The system calls this method during the state restoration process so that you can restore your view controller to its previous state.

If your app supports state restoration, override this method for any view controllers for which you also overrode the [`encodeRestorableState(with:)`](/documentation/UIKit/UIViewController/encodeRestorableState(with:)) method. Your implementation of this method should use any saved state information to restore the view controller to its previous configuration. If your [`encodeRestorableState(with:)`](/documentation/UIKit/UIViewController/encodeRestorableState(with:)) method called `super`, this method should similarly call `super` at some point in its implementation.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)