[+] Encapsulate sending an alert
This commit is contained in:
@@ -7,7 +7,9 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import CryptoKit
|
import CryptoKit
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
/// Date manipulations
|
||||||
extension Date
|
extension Date
|
||||||
{
|
{
|
||||||
/// Add toString to Date
|
/// Add toString to Date
|
||||||
@@ -79,6 +81,7 @@ extension TimeInterval
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Apply like Kotlin
|
/// Apply like Kotlin
|
||||||
protocol HasApply {}
|
protocol HasApply {}
|
||||||
extension HasApply
|
extension HasApply
|
||||||
@@ -93,6 +96,7 @@ extension HasApply
|
|||||||
extension Alarm: HasApply {}
|
extension Alarm: HasApply {}
|
||||||
extension Alarms: HasApply {}
|
extension Alarms: HasApply {}
|
||||||
|
|
||||||
|
|
||||||
/// Hashing
|
/// Hashing
|
||||||
extension Digest
|
extension Digest
|
||||||
{
|
{
|
||||||
@@ -104,3 +108,14 @@ extension String
|
|||||||
{
|
{
|
||||||
var sha256: String { SHA256.hash(data: self.data(using: .utf8)!).b64 }
|
var sha256: String { SHA256.hash(data: self.data(using: .utf8)!).b64 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Alerts
|
||||||
|
extension UIViewController
|
||||||
|
{
|
||||||
|
func alert(_ title: String, _ message: String)
|
||||||
|
{
|
||||||
|
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
||||||
|
self.present(alert, animated: true, completion: nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user