Chapter 15. Event Kit

The user’s life isn’t confined to the use of computers and phones, and many people even use technology to interact with other human beings. One capability of Apple devices is calendaring and scheduling, which is usually managed through built-in applications (the Calendar app on iOS and OS X).

However, it can be very useful for third-party applications to be able to access the calendar, either to create new appointments or to view what the user has lined up for the day. This information is exposed via Event Kit, the calendar data store API.

In this chapter, you’ll learn how to work with Event Kit to access the user’s calendar. The same API applies to both OS X and iOS; in this chapter, the sample code will be written for OS X.

Understanding Events

All of the information that relates to the user’s calendars comes from the Event Kit event store. This object, which is an instance of the EKEventStore, acts as the database of all calendars, which themselves contain events.

The event store stores multiple calendars, which are EKCalendar objects. Each calendar has information like its name, whether it’s editable, whether it’s a subscribed calendar, and so on.

An “event” is an entry in the user’s calendar, and is represented as an EKEvent object. Events contain several key pieces of information, including:

  • A text label describing what the event is

  • The date and times that the event begins and ends

  • The location of the event

  • When the event was created and last modified

EKEvent is ...

Get Learning Cocoa with Objective-C, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.