I want to create a list in the Reminders app using EventKit. For each created list, I want to create EKReminders. However, it seems that EventKit does not provide a way to create a reminder list directly. How can I achieve this?
How can I create a list in the Reminders app using EventKit?
Creating reminders requires an existing list. You can only add reminders to existing and mutable lists.
To create a list in EventKit, perform these steps:
- Create an instance of event store
var store = EKEventStore()
- Initialize EKCalendar with a reminder entity and the created event store instance.
let list = EKCalendar(for: .reminder, eventStore: store)
- Set up the source
list.source = source
- Set up the name
list.title = name
- Save the result
try store.saveCalendar(list, commit: true)
See the Managing Location-Based Reminders sample code that demonstrates it.
Once you create a list, follow steps outlined in Create Reminders to create and save your reminders to the list.