Action

public protocol Action : class

Represents the Action (runnable command).

  • id

    The action identifier. It should be unique throughout all Action identifiers.

    It is a common practice to start the action id with some prefix. For example, all bundled action identifiers start with the core. prefix.

    Declaration

    Swift

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

    Declaration

    Swift

    var name: String
  • displayInActionsPanel Default implementation

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

    Default Implementation

    Display actions in the Actions panel by default.

    Declaration

    Swift

    var displayInActionsPanel: Bool
  • priority Default implementation

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

    Default Implementation

    The default priority is normal.

    Declaration

    Swift

    var priority: ActionPriority
  • Checks if the action is applicable for the context.

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

    Declaration

    Swift

    func isApplicable(context: ActionContext) -> Bool

    Return Value

    true if action is applicable, false otherwise.

  • The action code.

    Do not call this method manually, use windowContext.runAction() instead.

    Declaration

    Swift

    func apply(context: ActionContext)
  • shortName Default implementation

    Short action name displayed in the Touch Bar.

    Default Implementation

    The default value is the full action name.

    Declaration

    Swift

    var shortName: String
  • The icon to be displayed in the Touch Bar.

    Declaration

    Swift

    var touchBarIcon: NSImage?