BeautyAlert helps you can easily design by determining the color, shape, and shadow direction of the alert according to your app style.
- swift: 4.0 or higher
- iOS: 13.0 or higher
BeautyAlert is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'BeautyAlert'
In the Xcode 13.0+ enter BeautyAlert URL in Add Package Dependency
https://github.com/ChaminLee/BeautyAlert
create BeautyAlert
instance
let beautyAlert = BeautyAlert()
You can choose the title and content messages, their color, and the color of the entire background.
beautyAlert.setContentAttribute(
title: "BeautyAlert Title ✨",
titleColor: .black,
message: "BeautyAlert helps to make custom alert easily",
messageColor: .black,
backgroundColor: .white
)
You can create a confirmation and cancel button, and you can also specify an action for each button.
// Cancel Button
beautyAlert.addButton(
title: "Cancel",
titleColor: .black,
backgroundColor: .lightGray,
style: .cancel,
action: cancelAction
)
// OK Button
beautyAlert.addButton(
title: "OK",
titleColor: .white,
backgroundColor: .orange,
style: .confirm,
action: confirmAction
)
// Actions
func confirmAction() {
// do confirm actions
}
func cancelAction() {
// do cancel actions
self.dismiss(animated: true, completion: nil)
}
Just present and use it!
self.present(beautyAlert, animated: true, completion: nil)
iPhone | iPad |
---|---|
You can configure style with one button or two buttons
1 Button (iPhone) | 2 Button (iPhone) |
---|---|
1 Button (iPad) | 2 Button (iPad) |
ChaminLee, trueman9512@naver.com
BeautyAlert is available under the MIT license. See the LICENSE file for more info.