AlertControllerBuilder

public class AlertControllerBuilder
extension AlertControllerBuilder: AlertBuilder
extension AlertControllerBuilder: AlertBuilderProtocol
extension AlertControllerBuilder: SheetBuilder

A builder to create an alert.

  • Declaration

    Swift

    public func addAction(defaultType title: String, validate: @escaping AlertControllerBuilder.ValidatorBlock, handler: @escaping AlertControllerBuilder.ActionValuesHandler) -> Self
  • Declaration

    Swift

    public func addAction(cancelType title: String, validate: @escaping AlertControllerBuilder.ValidatorBlock, handler: @escaping AlertControllerBuilder.ActionValuesHandler) -> Self
  • Declaration

    Swift

    public func addAction(destructiveType title: String, validate: @escaping AlertControllerBuilder.ValidatorBlock, handler: @escaping AlertControllerBuilder.ActionValuesHandler) -> Self
  • Declaration

    Swift

    public func add(textField key: String, configuration: @escaping AlertBuilder.TextFieldBuilder) -> Self
  • Declaration

    Swift

    public func title(_ title: String) -> Self
  • Declaration

    Swift

    public func message(_ message: String) -> Self
  • Declaration

    Swift

    public func addAction(builder: () -> UIAlertAction) -> Self
  • Declaration

    Swift

    public func build() -> UIAlertController
  • Declaration

    Swift

    @discardableResult
    public func show(in context: UIViewController, animated: Bool = true, completion: AlertControllerBuilder.ShowCompletion? = nil) -> HideableAlert
  • Create a new alert.

    Declaration

    Swift

    public static var alert: AlertBuilder { get }

    Return Value

    an alert builder.

  • Create a new sheet.

    Declaration

    Swift

    public static func sheet(_ barButtonItem: UIBarButtonItem) -> SheetBuilder

    Parameters

    barButtonItem

    the anchor.

    Return Value

    a sheet builder.

  • Create a new sheet.

    Declaration

    Swift

    public static func sheet(_ sourceRect: CGRect) -> SheetBuilder

    Parameters

    sourceRect

    the anchor.

    Return Value

    a sheet builder.

  • Create automatically an alert if this device is an ipad, otherwise a sheet.

    Declaration

    Swift

    public static func automaticStyle(_ barButtonItem: UIBarButtonItem) -> AlertBuilderProtocol

    Parameters

    barButtonItem

    the anchor.

    Return Value

    an alert builder.

  • Create automatically an alert if this device is an ipad, otherwise a sheet.

    Declaration

    Swift

    public static func automaticStyle(_ sourceRect: CGRect = .zero) -> AlertBuilderProtocol

    Parameters

    sourceRect

    the anchor.

    Return Value

    an alert builder.