NewYorkAlertController

public final class NewYorkAlertController : UIViewController

Create an alert similar to UIAlertController

Public

  • Styles indicating the type of NewYorkAlert to display.

    See more

    Declaration

    Swift

    public enum Style
  • Indicates if alert can be dismissed via background tap.

    Declaration

    Swift

    public var isTapDismissalEnabled: Bool { get set }
  • The array of text fields displayed by the alert.

    Declaration

    Swift

    public private(set) var textFields: [UITextField]

Initializers

  • Creates a standard NewYorkAlert with title, message and style.

    Declaration

    Swift

    public init(title: String?, message: String?, style: Style)

    Parameters

    title

    A title of alert.

    message

    A message of alert.

    style

    A style of alert to display.

    Return Value

    A NewYorkAlertController object.

View life cycle

  • Called when the view is about to made visible. Buttons and text fields will be actually added to NewYorkAlert here.

    Declaration

    Swift

    public override func viewWillAppear(_ animated: Bool)

Public method

  • Adds a button to the NewYorkAlert.

    Note

    If the button’s style is NewYorkButton.Style.cancel, the button will always be added to the bottom of the NewYorkAlert. If the number of buttons added to the NewYorkAlert is two and the style property is set to NewYorkAlertController.Style.alert, buttons will be displayed horizontally and the cancel button will be displayed on the left.

    Declaration

    Swift

    public func addButton(_ button: NewYorkButton)

    Parameters

    button

    A button to be added to the NewYorkAlert.

  • Adds buttons to the NewYorkAlert.

    Note

    If the button’s style is NewYorkButton.Style.cancel, the button will always be added to the bottom of the NewYorkAlert. If the number of buttons added to the NewYorkAlert is two and the style property is set to NewYorkAlertController.Style.alert, buttons will be displayed horizontally and the cancel button will be displayed on the left.

    Declaration

    Swift

    public func addButtons(_ buttons: [NewYorkButton])

    Parameters

    buttons

    An array of buttons to be added to the NewYorkAlert.

  • Adds a text field to the NewYorkAlert.

    Note

    You can add a text field only if the style property is set to NewYorkAlertController.Style.alert.

    Declaration

    Swift

    public func addTextField(configurationHandler: ((UITextField) -> Void)? = nil)

    Parameters

    configurationHandler

    A block for configuring the text field prior to displaying the NewYorkAlert.

  • Adds an image to the NewYorkAlert.

    Note

    You can add only one image to the NewYorkAlert.

    Declaration

    Swift

    public func addImage(_ image: UIImage?)

    Parameters

    image

    An image to be added to the NewYorkAlert