mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 20:10:08 +02:00
34 lines
770 B
Swift
34 lines
770 B
Swift
//
|
|
// LocalNotification.swift
|
|
// PHP Monitor
|
|
//
|
|
// Copyright © 2022 Nico Verbruggen. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import UserNotifications
|
|
|
|
class LocalNotification {
|
|
|
|
public static func send(title: String, subtitle: String) {
|
|
let content = UNMutableNotificationContent()
|
|
content.title = title
|
|
content.body = subtitle
|
|
|
|
let uuidString = UUID().uuidString
|
|
let request = UNNotificationRequest(
|
|
identifier: uuidString,
|
|
content: content,
|
|
trigger: nil
|
|
)
|
|
|
|
let notificationCenter = UNUserNotificationCenter.current()
|
|
notificationCenter.add(request) { (error) in
|
|
if error != nil {
|
|
Log.err(error!)
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|