EKCalendar Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/EventKit.framework
Availability
Available in iOS 4.0 and later.
Declared in
EKCalendar.h
EKTypes.h
Related sample code

Overview

An instance of the EKCalendar class represents a calendar in Event Kit. Use the properties in this class to get attributes about a calendar, such as its title and type. Use the calendarForEntityType:eventStore: method to create a calendar object.

Tasks

Creating Calendars

Accessing Calendar Properties

Properties

allowedEntityTypes

The entity types this calendar can contain. (read-only)

@property(nonatomic, readonly) EKEntityMask allowedEntityTypes
Discussion

While Event Kit only allows creation of single-entity calendars, other servers might allow mixed-entity calendars.

Availability
  • Available in iOS 6.0 and later.
Declared In
EKCalendar.h

allowsContentModifications

A Boolean value that indicates whether you can add, edit, and delete items in the calendar. (read-only)

@property(nonatomic, readonly) BOOL allowsContentModifications
Availability
  • Available in iOS 4.0 and later.
Declared In
EKCalendar.h

calendarIdentifier

A unique identifier for the calendar. (read-only)

@property(nonatomic, readonly) NSString *calendarIdentifier
Discussion

This property is set when the calendar is created and can be used as a local identifier. Use calendarWithIdentifier: to get a calendar with the specified identifier.

A full sync with the calendar will lose this identifier. You should have a plan for dealing with a calendar whose identifier is no longer fetch-able by caching its other properties.

Availability
  • Available in iOS 5.0 and later.
Declared In
EKCalendar.h

CGColor

The calendar’s color.

@property(nonatomic) CGColorRef CGColor
Special Considerations

This property is the equivalent of the color property on OS X.

Availability
  • Available in iOS 4.0 and later.
Declared In
EKCalendar.h

immutable

A Boolean value indicating whether the calendar’s properties can be edited or deleted. (read-only)

@property(nonatomic, readonly, getter=isImmutable) BOOL immutable
Discussion

If YES, the calendar is immutable; otherwise it is not. Events and reminders can still be added to an immutable calendar.

Availability
  • Available in iOS 5.0 and later.
Declared In
EKCalendar.h

source

The source object representing the account to which this calendar belongs.

@property(nonatomic, retain) EKSource *source
Discussion

This property can only be set for newly created calendar objects. This property is read-only after the first time it is set; setting a value to this property after the first time it is set will result in an error. Therefore, moving a calendar from one source to another is not supported.

Availability
  • Available in iOS 5.0 and later.
Declared In
EKCalendar.h

subscribed

A Boolean value indicating whether the calendar is a subscribed calendar. (read-only)

@property(nonatomic, readonly, getter=isSubscribed) BOOL subscribed
Discussion

If YES, the calendar is a subscribed calendar; otherwise it is not.

Availability
  • Available in iOS 5.0 and later.
Declared In
EKCalendar.h

supportedEventAvailabilities

The event availability settings supported by this calendar, as indicated by a bitmask. (read-only)

@property(nonatomic, readonly) EKCalendarEventAvailabilityMask supportedEventAvailabilities
Discussion

If the calendar doesn’t support event availability settings, this value is EKCalendarEventAvailabilityNone.

Availability
  • Available in iOS 4.0 and later.
Declared In
EKCalendar.h

title

The calendar’s title.

@property(nonatomic, copy) NSString *title
Availability
  • Available in iOS 4.0 and later.
Declared In
EKCalendar.h

type

The calendar’s type. (read-only)

@property(nonatomic, readonly) EKCalendarType type
Discussion

CalDAV-subscribed calendars are of type EKCalendarTypeCalDAV with isSubscribed set to YES.

Availability
  • Available in iOS 4.0 and later.
Declared In
EKCalendar.h

Class Methods

calendarForEntityType:eventStore:

Creates a new calendar that can contain the given entity type.

+ (EKCalendar *)calendarForEntityType:(EKEntityType *)entityType eventStore:(EKEventStore *)eventStore
Parameters
entityType

The entity type that this calendar may support.

eventStore

The event store in which to create this calendar.

Return Value

The created calendar.

Discussion

You can only create calendars that accept either reminders or events. Some servers might allow mixing the two, although it is not common.

Availability
  • Available in iOS 6.0 and later.
Declared In
EKCalendar.h

Constants

EKCalendarType

Possible calendar types.

typedef enum {
   EKCalendarTypeLocal,
   EKCalendarTypeCalDAV,
   EKCalendarTypeExchange,
   EKCalendarTypeSubscription,
   EKCalendarTypeBirthday,
} EKCalendarType;
Constants
EKCalendarTypeLocal

A local calendar.

Available in iOS 4.0 and later.

Declared in EKTypes.h.

EKCalendarTypeCalDAV

A CalDAV or iCloud calendar.

Available in iOS 4.0 and later.

Declared in EKTypes.h.

EKCalendarTypeExchange

An Exchange calendar.

Available in iOS 4.0 and later.

Declared in EKTypes.h.

EKCalendarTypeSubscription

A locally subscribed calendar.

Available in iOS 4.0 and later.

Declared in EKTypes.h.

EKCalendarTypeBirthday

A birthday calendar.

Available in iOS 4.0 and later.

Declared in EKTypes.h.

Availability
  • Available in iOS 4.0 and later.
Declared In
EKTypes.h

EKCalendarEventAvailabilityMask

A bitmask indicating the event availability settings that the calendar can support.

typedef NSUInteger EKCalendarEventAvailabilityMask;
Availability
  • Available in iOS 4.0 and later.
Declared In
EKTypes.h

EKCalendarEventAvailability

Event availability settings that the calendar can support.

enum {
   EKCalendarEventAvailabilityNone         = 0,
   EKCalendarEventAvailabilityBusy         = (1 << 0),
   EKCalendarEventAvailabilityFree         = (1 << 1),
   EKCalendarEventAvailabilityTentative    = (1 << 2),
   EKCalendarEventAvailabilityUnavailable  = (1 << 3),
};
Constants
EKCalendarEventAvailabilityNone

The calendar does not support event availability settings.

Available in iOS 4.0 and later.

Declared in EKTypes.h.

EKCalendarEventAvailabilityBusy

The calendar supports the busy event availability setting.

Available in iOS 4.0 and later.

Declared in EKTypes.h.

EKCalendarEventAvailabilityFree

The calendar supports the free event availability setting.

Available in iOS 4.0 and later.

Declared in EKTypes.h.

EKCalendarEventAvailabilityTentative

The calendar supports the tentative event availability setting.

Available in iOS 4.0 and later.

Declared in EKTypes.h.

EKCalendarEventAvailabilityUnavailable

The calendar supports the unavailable event availability setting.

Available in iOS 4.0 and later.

Declared in EKTypes.h.