<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/UndoManager/setActionName(_:)-cci9",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So13NSUndoManagerC10FoundationE13setActionNameyyAC23LocalizedStringResourceVSgF"
  },
  "title" : "setActionName(_:)"
}
-->

# setActionName(_:)

Sets the name of the action associated with the Undo or Redo command using a localized string resource.

```
@MainActor @preconcurrency final func setActionName(_ actionNameResource: LocalizedStringResource?)
```

## Parameters

`actionNameResource`

The name of the action, as a [`LocalizedStringResource`](/documentation/Foundation/LocalizedStringResource). Pass in `nil` to reset the action name currently associated with the menu command.

## Discussion

This version of `setActionName(_:)` takes a [`LocalizedStringResource`](/documentation/Foundation/LocalizedStringResource).
When using this version, [`undoActionName`](/documentation/Foundation/UndoManager/undoActionName), [`redoActionName`](/documentation/Foundation/UndoManager/redoActionName), [`undoMenuItemTitle`](/documentation/Foundation/UndoManager/undoMenuItemTitle), and [`redoMenuItemTitle`](/documentation/Foundation/UndoManager/redoMenuItemTitle) interpret the provided resource using the current locale.

The undo manager parses the parameter as Markdown using [`init(localized:)`](/documentation/Foundation/AttributedString/init(localized:)) in order to support inflection.

If `actionNameResource` is `nil`, the undo manager removes the action name currently associated with the menu command.

---

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)