[+] Add parameter "okayable" to alert function

This commit is contained in:
Hykilpikonna
2021-01-22 15:18:49 -05:00
parent facf8eaeec
commit 8f829217c1
2 changed files with 17 additions and 4 deletions
+15 -2
View File
@@ -110,12 +110,25 @@ extension String
}
/// Alerts
/// UI Extensions
extension UIViewController
{
func alert(_ title: String, _ message: String)
/**
Send an alert
- Parameter title: Title of the alert
- Parameter message: Body message of the alert
- Parameter okayable: Whether the alert can be okayed
*/
func alert(_ title: String, _ message: String, okayable: Bool = false)
{
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
if okayable
{
alert.addAction(UIAlertAction(title: "OK", style: .default))
}
self.present(alert, animated: true, completion: nil)
}
}