AlertView
public class AlertView : View
Wrapper of UIAlertController An object that displays an alert message to the user.
AlertView(title: "Title", message: "Message", preferredStyle: UIAlertController.Style.alert)
.destructive(title: "Delete") { text in
// delete action
}
.cancel(title: "Cancel") {
// cancel action
}
.show()
-
The node behind the alert view.
Declaration
Swift
public var node: ArgoKitNode? { get }
-
Initializer
Declaration
Swift
public init(title: String? = "", message: String? = "", preferredStyle: UIAlertController.Style)
Parameters
title
The title of the alert. Use this string to get the user’s attention and communicate the reason for the alert.
message
Descriptive text that provides additional details about the reason for the alert.
preferredStyle
The style to use when presenting the alert controller. Use this parameter to configure the alert controller as an action sheet or as a modal alert.
-
Sets the title of the alert.
Declaration
Swift
@discardableResult public func titile(_ value: @autoclosure @escaping () -> String?) -> Self
Parameters
value
The title of the alert. Use this string to get the user’s attention and communicate the reason for the alert.
Return Value
self
-
Sets descriptive text that provides additional details about the reason for the alert.
Declaration
Swift
@discardableResult public func message(_ value: @autoclosure @escaping () -> String?) -> Self
Parameters
value
Descriptive text that provides additional details about the reason for the alert.
Return Value
self
-
Add default style Action.
Declaration
Swift
@discardableResult public func `default`(title: String?, handler: ((String?) -> Void)?) -> Self
Parameters
title
The text to use for the button title. The value you specify should be localized for the user’s current language.
handler
A block to execute when the user selects the action. This block has no return value and takes the selected action object as its only parameter.
Return Value
self
-
Add cancel style Action.
Declaration
Swift
@discardableResult public func cancel(title: String?, handler: (() -> Void)?) -> Self
Parameters
title
The text to use for the button title. The value you specify should be localized for the user’s current language.
handler
A block to execute when the user selects the action. This block has no return value and takes the selected action object as its only parameter.
Return Value
self
-
Add destructive style Action.
Declaration
Swift
@discardableResult public func destructive(title: String?, handler: ((String?) -> Void)?) -> Self
Parameters
title
The text to use for the button title. The value you specify should be localized for the user’s current language.
handler
A block to execute when the user selects the action. This block has no return value and takes the selected action object as its only parameter.
Return Value
self
-
Add TextField.
Declaration
Swift
@discardableResult public func textField() -> Self
Return Value
self
-
Present alert view
Declaration
Swift
public func show()