TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Oct 2017 |
SwiftSwift Version | 3.0.2 |
SPMSupports SPM | ✗ |
Maintained by TomoyaHayakawa.
Simple UIAlertController and UIAlertView wrapper.
Enable to use Swifty.
To install SwiftyAlert without a dependency manager, please add Alert.swift to your Xcode Project.
import SwiftyAlert
Alert(title: "AlertTitle").addOk().show(self)
Alert(title: "Alert", message: "Simple Alert.")
.addDefault("OK")
.show()
Alert(title: "ActionSheet", style: .ActionSheet)
.addDefault("Take Photo") { print("take phote") }
.addDefault("Open Library") { print("open library") }
.addDestructive("Delete") { print("delete") }
.addCancel()
.handlePopoverController { [weak self] controller in //for iPad
controller?.sourceView = self?.view
controller?.sourceRect = sender.frame
}
.show()
Alert(title: "Alert", message: "Alert with TextField.")
.addTextField { textField in
textField.placeholder = "ID"
}
.addTextField { textField in
textField.placeholder = "Password"
textField.secureTextEntry = true
}
.handleTextFieldDidChange { textField, index in
print("Index of textFields:", index, "text:", textField.text)
if textField.text?.characters.count > 5 {
textField.text = ""
}
}
.addDefaultWithTextField("Login") { textFields in
textFields?.forEach({ print($0.text) })
}
.addCancel("Back") { print("Cancelled") }
.show() { print("Completion") }
Alert.okButtonTitle = "Go"
Alert.cancelButtonTitle = "Back"
Please report bug to @Sim_progra
at Twitter.