Action

public protocol Action : AnyObject

Action (any runnable command).

  • id

    Action identifier. Should be unique throughout all actions.

    It is a common practice to start the action id with a package prefix, like in Java. All bundled action identifiers start with the core. prefix.

    Declaration

    Swift

    var id: String { get }
  • Action name displayed in the Actions panel.

    Declaration

    Swift

    var name: String { get }
  • displayInActionsPanel Default implementation

    True if this action should be displayed in the Actions panel.

    Default Implementation

    Declaration

    Swift

    var displayInActionsPanel: Bool { get }
  • priority Default implementation

    Action priority.

    Affects the Action position in the Actions menu (displayed when more than one action available).

    Default Implementation

    Declaration

    Swift

    var priority: ActionPriority { get }
  • True if the action is applicable to the given context.

    Note: Avoid the time-consuming checks, do only the basic validation.

    Declaration

    Swift

    func isApplicable(context: ActionContext) -> Bool
  • Action code.

    Do not call apply() manually, use WindowContext.runAction() instead.

    Declaration

    Swift

    func apply(context: ActionContext)
  • shortName Default implementation

    Action name displayed in the Touch Bar.

    Default Implementation

    The default value is the full action name.

    Declaration

    Swift

    var shortName: String { get }
  • Icon to be displayed in the Touch Bar.

    Declaration

    Swift

    var touchBarIcon: NSImage? { get }