How to make calander event & reminder.
Basic flow about making calander event and reminder in Swift 4.0
let eventStore = EKEventStore()
let reminder = EKReminder(eventStore: eventStore)
reminder.title = "reminder"
reminder.calendar = eventStore.defaultCalendarForNewReminders()
let event = EKEvent(eventStore: eventStore)
event.title = "title"
event.startDate = Date()
event.endDate = Date()
event.addAlarm(EKAlarm(relativeOffset: 0))
event.calendar = eventStore.defaultCalendarForNewEvents
try? eventStore.save(event, span: .thisEvent, commit: true)
Setting event/remider calendar property is very important.
reminder.calendar = eventStore.defaultCalendarForNewReminders()
or
event.calendar = eventStore.defaultCalendarForNewEvents