Contents

EKEventStore

An object that accesses a person’s calendar events and reminders and supports the scheduling of new events.

Declaration

class EKEventStore

Mentioned in

Overview

The EKEventStore class is an app’s point of contact for accessing calendar and reminder data.

After initializing the event store, you must request access to events or reminders before attempting to fetch or create data. To request access to reminders, call requestFullAccessToReminders(completion:). To request access to events, call requestWriteOnlyAccessToEvents(completion:) or requestFullAccessToEvents(completion:).

A typical workflow for using an event store is:

  1. Create a predicate, or a search query for events, with predicateForEvents(withStart:end:calendars:).

  2. Fetch and process events that match the predicate with the events(matching:) and enumerateEvents(matching:using:) methods.

  3. Save and delete events from the event store with the save(_:span:commit:) and remove(_:span:commit:) methods.

Use similar methods to access and manipulate reminders.

After receiving an object from an event store, don’t use that object with a different event store. This restriction applies to EKObject subclasses such as EKEvent, EKReminder, EKCalendar, and EKSource, as well as predicates that the event store creates. For example, don’t fetch an event from one event store, modify the event, and then pass it to save(_:span:) in a different store.

Topics

Creating event stores

Requesting access to events and reminders

Accessing account sources

Saving and restoring state

Accessing calendars

Accessing calendar events

Searching calendars

Deprecated methods

Structures

See Also

Essentials