Create and modify events and reminders in a user's database.
Once you have permission to access a user's Calendar and Reminder data, you can create, display, and edit events and reminders.
You can edit the details of a new event or an event you previously fetched from the Calendar database by setting the event’s corresponding properties. Some of the details you can edit include:
The event’s title with the
The calendar with which the event is associated with the
The event’s recurrence rule, if it is a repeating event, with the
recurrenceproperty (see "Creating a Recurring Event" for more details).
Save and Delete Events
Save your changes to the Calendar database with the
save(_:. If you want to remove an event from the Calendar database, use the
remove(_:. Whether you are saving or removing an event, implementing the respective method automatically syncs your changes with the calendar the event belongs to (CalDAV, Exchange, and so on).
If you are saving a recurring event, your changes can apply to all future occurrences of the event by specifying
EKSpan for the span parameter of the
save(_: method. Likewise, you can remove all future occurrences of an event by specifying
EKSpan for the
span parameter of the
Reminders are tasks that may be tied to a specific time or location. They are similar to calendar events, but can be marked complete and may not necessarily span an exact period of time.
EKReminder inherits from
EKCalendar, you can perform the same methods on a reminder as you would on an event, such as adding an alarm with
add or setting a recurrence rule with
Like events, reminders can trigger time-based or location-based alarms to alert the user of a certain task. Read "Setting an Alarm" for more information on how to attach alarms to calendar items.
Save and Delete Reminders
To save a reminder to the Calendar database, call the
remove(_: method. The
calendars properties must explicitly be set before you save the reminder.