CreationKit Documentation

Class Action

public final class Action  

An action that can be taken when the user taps a button.

You use this class to configure information about a single action, including the title to display in the button, any styling information, and a handler to execute when the user taps the button.

Nested Types

Action.Style

Styles to apply to action buttons.

Initializers

init(title:​image:​image​Side:​style:​handler:​)

public init(
    title: String, image: UIImage? = nil,
    imageSide: LateralDirection = .left, style: Style = .default, handler: ((Action) -> Void)? = nil
  )  

Create and return an action with the specified title and behavior.

Actions are enabled by default when you create them.

Parameters

title String

The text to use for the button title.

image UIImage?

The image to place next to the actions title.

style Style

Additional styling information to apply to the button. Use the style information to convey the type of action that is performed by the button.

handler ((Action) -> Void)?

A closure to execute when the user selects the action. This closure has no return value and takes the selected action object as its only parameter.

Properties

title

public var title: String

The title of the action's button.

image

public var image: UIImage? 

The image to place next to the actions title.

image​Side

public var imageSide: LateralDirection

style

public var style: Style

The style that is applied to the action's button.

is​Enabled

public var isEnabled: Bool = true

A boolean value indicating whether the action is currently enabled.

The default value of this property is true. Changing the value to false causes the action to appear dimmed in the resulting dialog. When an action is disabled, taps on the corresponding button have no effect.