<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIApplication/registerObject(forStateRestoration:restorationIdentifier:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIApplication(cm)registerObjectForStateRestoration:restorationIdentifier:"
  },
  "title" : "registerObject(forStateRestoration:restorationIdentifier:)"
}
-->

# registerObject(forStateRestoration:restorationIdentifier:)

Registers a custom object for use with the state restoration system.

```
class func registerObject(forStateRestoration object: any UIStateRestoring, restorationIdentifier: String)
```

## Parameters

`object`

The object to be registered with the restoration archive. The object must adopt the [`UIStateRestoring`](/documentation/UIKit/UIStateRestoring) protocol. This parameter must not be `nil`.

`restorationIdentifier`

The restoration identifier for the object. UIKit uses this parameter to distinguish the object from other objects in the archive. This parameter must not be `nil`.

## Discussion

You use this method to register objects that you want to save as part of the overall state restoration process. Registering the object makes it available for inclusion in the restoration archive but does not automatically include it. To include the object, refer to it from one of your other interface objects. For example, you might write out a reference to the object from the [`encodeRestorableState(with:)`](/documentation/UIKit/UIViewController/encodeRestorableState(with:)) method of one of your view controllers.

---

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)