Created
May 29, 2018 09:31
-
-
Save pgpt10/88353ad048cad4652c5892c73370fbc9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Notification Content | |
let content = UNMutableNotificationContent() | |
content.title = "Invitation" | |
content.subtitle = "This is a Local Notification." | |
content.body = "You are invited." | |
content.categoryIdentifier = "INVITATION" | |
content.sound = UNNotificationSound.default() | |
//Notification Trigger - when the notification should be fired | |
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false) | |
//Notification Request | |
let request = UNNotificationRequest(identifier: "Anniversary", content: content, trigger: trigger) | |
//Scheduling the Notification | |
let center = UNUserNotificationCenter.current() | |
center.add(request) { (error) in | |
if let error = error | |
{ | |
print(error.localizedDescription) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment