Contents

setActionName(_:)

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

Declaration

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

Parameters

  • actionNameResource:

    The name of the action, as a Localizedstringresource. Pass in nil to reset the action name currently associated with the menu command.

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