Square's purpose is that to use UIAlertController easily.
Square requires iOS 8 or above and is written in Swift 5.0
Suqare is available through CocoaPods. To install it, simply add the following line to your podfile:
pod 'Square', '~> 0.6.3'
And run pod install
.
Suqare is available through Carthage. Simply install carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
add Suqare to your Cartfile
:
github "devmjun/Square" ~> 0.6.3
And run carthage update
.
// 1
Square.display("Title")
// 2
Square.display("Title", message: "Title")
// 3
Square.display("Title", message: "Title", alertAction: .default(messgae: "OK")) {
print("Action!")
}
Square.display("Title", message: "Message", alertActions: [.cancel(message: "Cancel"), .destructive(message: "Detructive"), .default(messgae: "Default")]) { (alertAction, index) in
if index == 0 {
// Cancel action
}else if index == 1 {
// Destructive action
}else if index == 2 {
// Default action
}
}
Square.display("Title", message: "Message", alertAction: .default(messgae: "OK"), preferredStyle: .actionSheet) {
// Alert Action
}
Square.display("Title", message: "Message", alertActions: [.cancel(message: "Cancel"), .destructive(message: "Detructive"), .default(messgae: "Default")], preferredStyle: .actionSheet) { (alertAction, index) in
if index == 0 {
// Cancel action
}else if index == 1 {
// Destructive action
}else if index == 2 {
// Default action
}
}
Square.debugAlert()
above a method is useful when you need to know where the function is running
let alertController = Square.display("Title")
alertController.setValue(attributedTitle, forKey: "attributedTitle")
alertController.setValue(attributedMessage, forKey: "attributedMessage")
alertController.view.tintColor = SomeColor
Bug reports, pull request and any discussion are welcome💖
Square is available as open source under the terms of the MIT License