Created
May 29, 2018 09:31
-
-
Save pgpt10/2794797c9407ad9c7533bc73b7c77a31 to your computer and use it in GitHub Desktop.
This file contains 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