UICommand

public extension UICommand
  • Updates a command to reflect the current state of a bound action.

    Sets the attributes of the command to be disabled if the action is nil or if the action can’t be performed right now. Optionally updates the title of the command.

    This can be used in UIResponder.validate(_:) to update the command for a menu item before it is about to be displayed.

    Declaration

    Swift

    func update<T>(_ action: BoundUserAction<T>?, updateTitle: Bool = false)

    Parameters

    action

    The bound action whose state should be reflected in the command.

    updateTitle

    Whether to also update the title of the command. Defaults to false.