<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSResponder/updateUserActivityState(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSResponder(im)updateUserActivityState:"
  },
  "title" : "updateUserActivityState(_:)"
}
-->

# updateUserActivityState(_:)

Updates the state of the given user activity.

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

## Parameters

`userActivity`

The user activity to be updated.

## Discussion

Subclasses override this method to update the state of the supplied `userActivity`. Add state representing the user’s activity into `userActivity` using its <doc://com.apple.documentation/documentation/Foundation/NSUserActivity/addUserInfoEntries(from:)> method. When the state is dirty, set the <doc://com.apple.documentation/documentation/Foundation/NSUserActivity/needsSave> property to <doc://com.apple.documentation/documentation/Swift/true>.

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

## See Also

[`NSResponder`](/documentation/AppKit/NSResponder)

An abstract class that forms the basis of event and command processing in AppKit.



---

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)