AlertBuilder

public class AlertBuilder: NSObject

A builder object that makes familiar alert easily.

  • Creates and returns a builder for a confirmable alert builder.

    __________________________
    |         Title          |
    |                        |
    |        message         |
    |                        |
    |          OK            |
    |________________________|
    
    AlertBuilder()
      .confirm(title: "Title", message: "message")
      .approve { _ in
    
      }
      .present(in: self)
    

    Declaration

    Swift

    public func confirm(title: String? = nil, message: String?) -> Approve

    Parameters

    title

    The title of the alert.

    message

    The message of the alert.

    Return Value

    An approvable object.

  • Creates and returns a builder for a confirmable alert builder.

    __________________________
    |         Error          |
    |                        |
    |    error localized     |
    |      description.      |
    |                        |
    |          OK            |
    |________________________|
    
    AlertBuilder()
      .confirm(error: error)
      .approve { _ in
    
      }
      .present(in: self)
    

    Declaration

    Swift

    public func confirm(title: String? = "Error", error: Error) -> Approve

    Parameters

    title

    The title of the alert. The default value is Error

    error

    The error to display to the user.

    Return Value

    An approvable object.

  • Creates and returns a builder for a suggestable alert.

    __________________________
    |         Title          |
    |                        |
    |        message         |
    |                        |
    |    Cancel      OK      |
    |________________________|
    
    AlertBuilder()
      .suggest(title: "Title", message: "message")
      .cancel { _ in
    
      }
      .approve { _ in
    
      }
      .present(in: self)
    

    Declaration

    Swift

    public func suggest(title: String?, message: String?) -> Cancel

    Parameters

    title

    The title of the alert.

    message

    The message to display to the user.

    Return Value

    A cancelable object.

  • Creates and returns a builder for a suggestable alert.

    __________________________
    |         Error          |
    |                        |
    |    error localized     |
    |      description.      |
    |                        |
    |    Cancel      OK      |
    |________________________|
    
    AlertBuilder()
      .suggest(error: error)
      .cancel { _ in
    
      }
      .approve { _ in
    
      }
      .present(in: self)
    

    Declaration

    Swift

    public func suggest(title: String? = "Error", error: Error) -> Cancel

    Parameters

    title

    The title of the alert. The default value is Error

    error

    The error to display to user.

    Return Value

    A cancelable object.