Skip to content

Instantly share code, notes, and snippets.

@grav
Last active January 29, 2016 12:36
Show Gist options
  • Save grav/f1b76276ba4398466b2f to your computer and use it in GitHub Desktop.
Save grav/f1b76276ba4398466b2f to your computer and use it in GitHub Desktop.
Creating an EKReminder
// remember to
// import EventKit
let s = EKEventStore.init()
s.requestAccessToEntityType(EKEntityType.Reminder) { (comp, e) -> Void in
print(comp,e)
let r = EKReminder.init(eventStore: s)
r.title = "Testreminder!"
let d = NSDate.init().dateByAddingTimeInterval(60)
let a = EKAlarm.init(absoluteDate: d)
r.calendar = s.defaultCalendarForNewReminders()
r.addAlarm(a)
do{
try s.saveReminder(r, commit: true)
print(r, "saved")
} catch {
print("couldnt save")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment