URBNAlert 3.1.1

URBNAlert 3.1.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Feb 2020

Maintained by Jason Grandelli, Ryan Garchinsky, Raymond Migneco, Evan Dutcher, URBN, Matt Thomas, Nicole Souvenir.



URBNAlert 3.1.1

  • By
  • Kevin Taniguchi

URBNAlert

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage

After adding URBNAlert to your projects Podfile, import URBNAlert using the following import line: #import URBNAlert

Setting Alert Style:

var alertStyler = AlertStyler()

// Blur Styling
alertStyler.blur.isEnabled = false
alertStyler.blur.tint = UIColor.red

// Button Styling
alertStyler.button.backgroundColor = UIColor.white
alertStyler.button.highlightBackgroundColor = .UIColor.lightGray
alertStyler.button.titleColor = UIColor.black

// Message Styling
alertStyler.message.color = UIColor.darkGray
alertStyler.message.backgroundColor = UIColor.white

// Assign styler to your alert
let alert = AlertViewController(message: “Alert Title”)
alert.alertStyler = alertStyler

1 Action Alert Example:

Alt text

let alert = AlertViewController(message: “Alert Title”)

let action = AlertAction(type: .custom, title: “Action Title”), completion: { _ in
    // Perform action here
}

alert.addActions([action])

alert.show()

2 Action Alert Example:

Alt text

3+ Action Alert Example:

Alt text

Custom View Alert Example:

Alt text

let imageView = UIImageView(image: UIImage.stretchableImage(color: .blue))
imageView.contentMode = .scaleAspectFit
imageView.heightAnchor.constraint(equalToConstant: 200).isActive = true

let stackView = UIStackView(arrangedSubviews: [customLabel, imageView])
stackView.axis = .vertical
stackView.spacing = 10
let containerView = UIView()

containerView.widthAnchor.constraint(equalToConstant: view.frame.width - 2 * 30).isActive = true
containerView.embed(subview: stackView, insets: UIEdgeInsets(top: 0, left: 18, bottom: 18, right: 18))

Textfield Alert Example:

Alt text

let alert = AlertViewController(title: "Alert Title", message: sampleMessage)

alert.addTextfield { textField in
    textField.setStylesForAlert()
}

alert.addActions(action)
alert.show()

Requirements

Installation

URBNSwiftAlert is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "URBNSwiftAlert"

Author

URBN Mobile Team, [email protected]

License

URBNSwiftAlert is available under the MIT license. See the LICENSE file for more info.