URBNAlert

URBNAlert is a customizable alert view based off of iOS's UIAlertController

Showing:

Popularity

Downloads/wk

0

GitHub Stars

81

Maintenance

Last Commit

2yrs ago

Contributors

16

Package

Dependencies

1

License

MIT

Categories

Readme

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, mobileteam@urbn.com

License

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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100