AlertBuilder
public protocol AlertBuilder : AlertBuilderProtocol
A protocol to define functions for sheet.
-
Undocumented
Declaration
Swift
typealias TextFieldBuilder = (UITextField) -> Void -
Undocumented
Declaration
Swift
typealias ActionValuesHandler = (_ action: UIAlertAction, _ values: [String : String]) -> Void -
Undocumented
Declaration
Swift
typealias ValidatorBlock = (_ values: [String : String]) -> Bool -
Add an action with default style to the alert.
Declaration
Swift
func addAction(defaultType title: String, validate: @escaping ValidatorBlock, handler: @escaping Self.ActionValuesHandler) -> SelfParameters
titlethe title of the action.
validatethis closure return true if this action is enabled, false otherwise.
handlerthe callback when selecting it.
Return Value
self for chaining.
-
Add an action with cancel style to the alert.
Declaration
Swift
func addAction(cancelType title: String, validate: @escaping ValidatorBlock, handler: @escaping Self.ActionValuesHandler) -> SelfParameters
titlethe title of the action.
validatethis closure return true if this action is enabled, false otherwise.
handlerthe callback when selecting it.
Return Value
self for chaining.
-
Add an action with destructive style to the alert.
Declaration
Swift
func addAction(destructiveType title: String, validate: @escaping ValidatorBlock, handler: @escaping Self.ActionValuesHandler) -> SelfParameters
titlethe title of the action.
validatethis closure return true if this action is enabled, false otherwise.
handlerthe callback when selecting it.
Return Value
self for chaining.
-
Add a text field to the alert.
Declaration
Swift
func add(textField key: String, configuration: @escaping TextFieldBuilder) -> SelfParameters
keythe associated key to retrieve the value from this text field.
configurationthe text field configuration.
Return Value
self for chaining.
-
addAction(defaultType:Extension methodhandler: ) Add an action with default style to the alert.
Declaration
Swift
public func addAction(defaultType title: String, handler: @escaping Self.ActionValuesHandler) -> SelfParameters
titlethe title of the action.
handlerthe callback when selecting it.
-
addAction(cancelType:Extension methodhandler: ) Add an action with cancel style to the alert.
Declaration
Swift
public func addAction(cancelType title: String, handler: @escaping Self.ActionValuesHandler) -> SelfParameters
titlethe title of the action.
handlerthe callback when selecting it.
-
addAction(destructiveType:Extension methodhandler: ) Add an action with destructive style to the alert.
Declaration
Swift
public func addAction(destructiveType title: String, handler: @escaping Self.ActionValuesHandler) -> SelfParameters
titlethe title of the action.
handlerthe callback when selecting it.
-
add(textField:Extension method) Add a text field to the alert.
Declaration
Swift
public func add(textField key: String) -> SelfParameters
keythe associated key to retrieve the value from this text field.
Return Value
self for chaining.
View on GitHub
Install in Dash
AlertBuilder Protocol Reference