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

# restoreUserActivityState(_:)

Restores the state needed to continue the given user activity.

```
func restoreUserActivityState(_ userActivity: NSUserActivity)
```

## Parameters

`userActivity`

The user activity to be continued.

## Discussion

Subclasses override this method to restore the responder’s state with the given user activity. The override should use the state data contained in the `userInfo` dictionary of the given user activity to restore the object.

The system can restore user activities that [`UIDocument`](/documentation/UIKit/UIDocument) manages automatically, if you return <doc://com.apple.documentation/documentation/Swift/false> from [`application(_:continue:restorationHandler:)`](/documentation/UIKit/UIApplicationDelegate/application(_:continue:restorationHandler:)) or if you don’t implement the method. In this situation, the [`UIDocumentViewController`](/documentation/UIKit/UIDocumentViewController) method [`openDocument(completionHandler:)`](/documentation/UIKit/UIDocumentViewController/openDocument(completionHandler:)) opens the document, and calls [`restoreUserActivityState(_:)`](/documentation/UIKit/UIDocument/restoreUserActivityState(_:)).

---

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)