Christian Seiler
Christian Seiler

Reputation: 1140

Add Reminder List programmatically

I'm building an application that interacts with the macOS Reminder App. I'm trying to create a new Reminder list into which I later can import reminders.

This is what I have so far:

func setCalendar(_ type: EKEntityType) {

    let eventStore = EKEventStore()

    let newCalendar = EKCalendar(for: type, eventStore: eventStore)
    newCalendar.title="newcal"
    print("Cal: " + newCalendar.title)

    try? eventStore.saveCalendar(newCalendar, commit: true)

}

However, there is no reminder list being created.

Upvotes: 0

Views: 980

Answers (1)

matt
matt

Reputation: 535586

The problem is that you have omitted to specify the new calendar's .source. You cannot create a calendar of any kind (event or reminder) without doing that.

Upvotes: 1

Related Questions