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

# updateUserActivityState(_:)

Updates the state of the given user activity.

```
func updateUserActivityState(_ activity: NSUserActivity)
```

## Parameters

`activity`

The user activity to be updated.

## Discussion

Subclasses override this method to update the state of the given user activity. You should add state representing the user’s activity into the <doc://com.apple.documentation/documentation/Foundation/NSUserActivity> object using its <doc://com.apple.documentation/documentation/Foundation/NSUserActivity/addUserInfoEntries(from:)> method. When the state is dirty, you should set the <doc://com.apple.documentation/documentation/Foundation/NSUserActivity/needsSave> property of the <doc://com.apple.documentation/documentation/Foundation/NSUserActivity> to <doc://com.apple.documentation/documentation/Swift/true>, and this method will be called at an appropriate time.

When an <doc://com.apple.documentation/documentation/Foundation/NSUserActivity> object managed by UIKit is updated, an empty `userInfo` dictionary is given to the <doc://com.apple.documentation/documentation/Foundation/NSUserActivity> object, and all of the objects associated with the <doc://com.apple.documentation/documentation/Foundation/NSUserActivity> are then sent an [`updateUserActivityState(_:)`](/documentation/UIKit/UIResponder/updateUserActivityState(_:)) message.

---

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)