-
Notifications
You must be signed in to change notification settings - Fork 0
/
Notifications.swift
31 lines (25 loc) · 913 Bytes
/
Notifications.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
// Notifications.swift
// SheetVision
//
// Created by Juan Carlos Martínez Sevilla on 18/5/23.
//
import Foundation
import UserNotifications
// Function to send a notification
func sendNotification() {
let content = UNMutableNotificationContent()
content.title = "Request Finished"
content.body = "The request has completed successfully."
content.sound = .default
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)
let request = UNNotificationRequest(identifier: "RequestNotification", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request) { error in
if let error = error {
// Handle error
print("Failed to schedule notification: \(error)")
} else {
// Notification scheduled successfully
}
}
}