Skip to content

Instantly share code, notes, and snippets.

@DonMag
Created September 23, 2016 15:09
Show Gist options
  • Select an option

  • Save DonMag/716021cd3f34009945fd8b814dd4693d to your computer and use it in GitHub Desktop.

Select an option

Save DonMag/716021cd3f34009945fd8b814dd4693d to your computer and use it in GitHub Desktop.
var notification = UILocalNotification()
notification.fireDate = NSDate(timeIntervalSinceNow: 15)
notification.alertBody = "15-second notification"
notification.alertAction = "15 seconds"
notification.soundName = UILocalNotificationDefaultSoundName
notification.userInfo = ["CustomField1": "15"]
UIApplication.sharedApplication().scheduleLocalNotification(notification)
notification = UILocalNotification()
notification.fireDate = NSDate(timeIntervalSinceNow: 20)
notification.alertBody = "20-second notification"
notification.alertAction = "20 seconds"
notification.soundName = UILocalNotificationDefaultSoundName
notification.userInfo = ["CustomField1": "20"]
UIApplication.sharedApplication().scheduleLocalNotification(notification)
notification = UILocalNotification()
notification.fireDate = NSDate(timeIntervalSinceNow: 25)
notification.alertBody = "25-second notification"
notification.alertAction = "25 seconds"
notification.soundName = UILocalNotificationDefaultSoundName
notification.userInfo = ["CustomField1": "25"]
UIApplication.sharedApplication().scheduleLocalNotification(notification)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment