---
title: "setActionName(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/undomanager/setactionname(_:)-cci9"
---

# setActionName(_:)

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

## Declaration

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

## Parameters

- `actionNameResource`: The name of the action, as a doc://com.apple.foundation/documentation/Foundation/LocalizedStringResource. Pass in nil to reset the action name currently associated with the menu command.

## Discussion

Discussion This version of setActionName(_:) takes a LocalizedStringResource. When using this version, undoActionName, redoActionName, undoMenuItemTitle, and redoMenuItemTitle interpret the provided resource using the current locale. The undo manager parses the parameter as Markdown using init(localized:) in order to support inflection. If actionNameResource is nil, the undo manager removes the action name currently associated with the menu command.

## See Also

### Managing the action name

- [undoActionName](foundation/undomanager/undoactionname.md)
- [redoActionName](foundation/undomanager/redoactionname.md)
- [setActionName(_:)](foundation/undomanager/setactionname(_:)-8lzip.md)
