How can I create a list in the Reminders app using EventKit?

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?

Replies

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:

  1. Create an instance of event store
    var store = EKEventStore()
  1. Initialize EKCalendar with a reminder entity and the created event store instance.
let list = EKCalendar(for: .reminder, eventStore: store)
  1. Set up the source
     list.source = source
  1. Set up the name
     list.title = name
  1. 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.