Skip to content

Instantly share code, notes, and snippets.

@lmiller1990
Created October 8, 2019 13:14
Show Gist options
  • Save lmiller1990/370e41005eba96d7905e71feab36a094 to your computer and use it in GitHub Desktop.
Save lmiller1990/370e41005eba96d7905e71feab36a094 to your computer and use it in GitHub Desktop.
func scheduleNotifications() -> Void {
for notification in notifications {
let content = UNMutableNotificationContent()
content.title = notification.title
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
let request = UNNotificationRequest(identifier: notification.id, content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request) { error in
guard error == nil else { return }
print("Scheduling notification with id: \(notification.id)")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment