Tech —

Apple invites developers into the Calendar Store

Apple posts developer information describing how to get access to the calendar …

Apple has had a history of releasing software that takes advantage of custom frameworks that only later get opened up for general use. For example, apps originating in Cupertino seem to have pioneered the use of Core Image and Core Animation in advance of Apple letting developers in on the action through a well-documented library of software interfaces. The latest bit of software to get this treatment is the Calendar Store, the software and database that power iCal.

Items like the Address Book and Calendar Store have an added significance that goes beyond the software interfaces. They include account-wide databases that keep useful and important information. Without access to that data, developers are stuck with a variety of unappealing options. The easy route is to ignore the data stored in Apple's applications, but that would leave the user stuck with needing to maintain and synchronize the same data across multiple applications. The only alternative is to hack into Apple's information, leaving apps at risk of breaking any time Apple changes anything.

The ideal situation is for Apple to provide the developers a framework that gives them not only tools for handling this data, but access to the data stores as well. The Address Book got this treatment back in 10.2, and any app has since had the ability to create or read contact information. Now, with 10.5, the same can finally be said for calendar data. Unlike the Address Book toolkit, which came with some interface elements, the Calendar Store is software-only. Of course, AppKit has always provided controls with the ability to enter dates.

On the software side, all the action goes through a class called CalCalendarStore. You get a single Calendar Store per app—that, in turn, provides you with access to individual calendars, events, tasks, and the rest. You can work your way through these items to find out if there are alarms and attendees associated with them, and whether they're set to recur at regular temporal intervals.

Finding the information already in the calendars is done by setting up a set of conditions to match, much the same way you'd set up a database search. To do this, you use a set of calendar-specific forms of NSPredicate, accessed through the CalCalendarStore. These let you find things such as completed or uncompleted tasks and set start and end dates for a search period. So, finding events to display has become no more difficult than figuring out how to calculate the start and end dates that you're interested in. Finding out when other software adds items to the Calendar Store is as simple as registering to be alerted by an NSNotificationCenter when a calendar item is created or deleted anywhere on the system.

Probably more significantly, developers can now create their own calendars, events, and to-dos. Properties of these items can be set using ObjectiveC 2.0's new dot syntax. Once you have everything set with your event, a single line of code will save it back to the calendar store, allowing the items to appear in iCal, Mail, and any other app that's paying attention. Considering the wide range of applications that might need to create an event or to-do, the ability to have them appear everywhere across your account is going to be a lot more useful than animating a few views (not that Core Animation's a bad thing).

Overall, the new framework appears to be pretty well-designed and easy-to-use, since it relies on standard Cocoa practices, such as using Predicates and Notification Centers. The only limitation appears to be the inability to store arbitrary data associated with events, meaning that applications that wish to track events with additional information will have to handle that internally—at least until 10.6.

Latest Ars Video >

First Look: Xbox Adaptive Controller

Ars Technica's Sam Machkovech visits Microsoft for a first-hand look at the company's new controller that focuses on accessibility.

First Look: Xbox Adaptive Controller

First Look: Xbox Adaptive Controller

Ars Technica's Sam Machkovech visits Microsoft for a first-hand look at the company's new controller that focuses on accessibility.