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) -> Self
Parameters
title
the title of the action.
validate
this closure return true if this action is enabled, false otherwise.
handler
the 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) -> Self
Parameters
title
the title of the action.
validate
this closure return true if this action is enabled, false otherwise.
handler
the 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) -> Self
Parameters
title
the title of the action.
validate
this closure return true if this action is enabled, false otherwise.
handler
the 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) -> Self
Parameters
key
the associated key to retrieve the value from this text field.
configuration
the 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) -> Self
Parameters
title
the title of the action.
handler
the 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) -> Self
Parameters
title
the title of the action.
handler
the 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) -> Self
Parameters
title
the title of the action.
handler
the callback when selecting it.
-
add(textField:
Extension method) Add a text field to the alert.
Declaration
Swift
public func add(textField key: String) -> Self
Parameters
key
the associated key to retrieve the value from this text field.
Return Value
self for chaining.