Class
ModalDialogAction
public final class ModalDialogAction
An action that can be taken when the user taps a button in a ModalDialog.
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. After creating an action object, add it to a ModalDialog object before displaying the corresponding dialog to the user.
Relationships
Nested Types
ModalDialogAction.Style
Styles to apply to action buttons in a dialog.
Initializers
init(title:image:rightImage:style:object:handler:)
public init(title: String, image: UIImage? = nil, rightImage: UIImage? = nil, style: Style, object: Any? = nil, handler: ((ModalDialogAction) -> Void)? = nil)
Create and return an action with the specified title and behavior.
Actions are enabled by default when you create them.
Parameters
Name | Type | Description |
---|---|---|
title | String |
The text to use for the button title. |
image | UIImage? |
The image to place next to the actions title. Images will only be displayed when used in a ModalDialog with the .actionSheet style. |
rightImage | UIImage? |
The image to place on the right side of the actions title. Images will only be displayed when used in a ModalDialog with the .actionSheet style. |
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. For a list of possible values, see the constants in ModalDialogAction.Style. |
object | Any? |
Any "object" that you'd like access to in the handler. |
handler | ((ModalDialogAction) -> Void)? |
A closure to execute when the user selects the action. This block has no return value and takes the selected action object as its only parameter. |
Properties
image
public var image: UIImage?
The image to place next to the actions title.
Images will only be displayed when used in a ModalDialog with the .actionSheet style.
rightImage
public var rightImage: UIImage?
isEnabled
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.
cancel
public static var cancel: ModalDialogAction
A general Cancel action that dismisses the dialog.
Methods
make(title:image:rightImage:style:object:handler:)
public static func make(
title: String, image: UIImage? = nil, rightImage: UIImage? = nil, style: Style,
object: Any? = nil, handler: ((ModalDialogAction) -> Void)? = nil) -> ModalDialogAction
Create and return an action with the specified title and behavior.
Actions are enabled by default when you create them.
Parameters
Name | Type | Description |
---|---|---|
title | String |
The text to use for the button title. |
image | UIImage? |
The image to place next to the actions title. Images will only be displayed when used in a ModalDialog with the .actionSheet style. |
rightImage | UIImage? |
The image to place on the right side of the actions title. Images will only be displayed when used in a ModalDialog with the .actionSheet style. |
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. For a list of possible values, see the constants in ModalDialogAction.Style. |
object | Any? |
Any "object" that you'd like access to in the handler. |
handler | ((ModalDialogAction) -> Void)? |
A closure to execute when the user selects the action. This block has no return value and takes the selected action object as its only parameter. |