Mac Developer Library

Developer

EventKit Framework Reference EKCalendarItem Class Reference

Options
Deployment Target:

On This Page
Language:

EKCalendarItem

The EKCalendarItem class is a an abstract superclass for calendar events and reminders. This class provides common properties and methods for accessing properties of calendar items such as the ability to set the calendar, title, and location as well as support for attaching notes, displaying attendees, setting multiple alarms, and specifying recurrence rules.

  • The calendar item’s unique identifier. (read-only)

    Declaration

    Swift

    var calendarItemIdentifier: String { get }

    Objective-C

    @property(nonatomic, readonly) NSString *calendarItemIdentifier

    Discussion

    This property is set when the calendar item is created and can be used as a local identifier. Use calendarItemWithIdentifier: to look up the item by this value.

    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 OS X v10.8 and later.

  • The calendar item’s external identifier as provided by the calendar server. (read-only)

    Declaration

    Swift

    var calendarItemExternalIdentifier: String { get }

    Objective-C

    @property(nonatomic, readonly) NSString *calendarItemExternalIdentifier

    Discussion

    This identifier allows you to access the same event or reminder across multiple devices.

    There are some cases where duplicate copies of a calendar item can exist in the same database:

    • A calendar item was imported from an ICS file into multiple calendars

    • An event was created in a calendar shared with the user and the user was also invited to the event

    • The user is a delegate of a calendar that also has this event

    • A subscribed calendar was added to multiple accounts

    In such cases, you should choose between calendar items based on other factors, such as the calendar or source.

    Recurring event identifiers are the same for all occurrences. If you wish to differentiate between occurrences, you may want to use the start date.

    For Exchange servers, the identifier is different between iOS and OS X and different between devices for reminders.

    Availability

    Available in OS X v10.8 and later.

  • The calendar for the calendar item.

    Declaration

    Swift

    var calendar: EKCalendar

    Objective-C

    @property(nonatomic, strong) EKCalendar *calendar

    Availability

    Available in OS X v10.8 and later.

  • The title for the calendar item.

    Declaration

    Swift

    var title: String

    Objective-C

    @property(nonatomic, copy) NSString *title

    Availability

    Available in OS X v10.8 and later.

  • The location associated with the calendar item.

    Declaration

    Swift

    var location: String?

    Objective-C

    @property(nonatomic, copy) NSString *location

    Discussion

    This property is nil if the calendar item has no location.

    Availability

    Available in OS X v10.8 and later.

  • The date that this calendar item was created. (read-only)

    Declaration

    Swift

    var creationDate: NSDate? { get }

    Objective-C

    @property(nonatomic, readonly) NSDate *creationDate

    Discussion

    If nil, this property was not set or was synced in this state.

    Availability

    Available in OS X v10.8 and later.

    See Also

    lastModifiedDate

  • The date that the calendar item was last modified. (read-only)

    Declaration

    Swift

    var lastModifiedDate: NSDate? { get }

    Objective-C

    @property(nonatomic, readonly) NSDate *lastModifiedDate

    Availability

    Available in OS X v10.8 and later.

    See Also

    creationDate

  • The time zone for the calendar item.

    Declaration

    Swift

    @NSCopying var timeZone: NSTimeZone?

    Objective-C

    @property(nonatomic, copy) NSTimeZone *timeZone

    Discussion

    If nil, the calendar item is a floating event. A floating event is not tied to a particular time zone. It occurs at a given time regardless of the time zone — for example, “lunch at noon.” The start and end times of a floating event should be set as if they were in the system time zone.

    Availability

    Available in OS X v10.8 and later.

  • URL URL Property

    The URL for the calendar item.

    Declaration

    Swift

    @NSCopying var URL: NSURL?

    Objective-C

    @property(nonatomic, copy) NSURL *URL

    Availability

    Available in OS X v10.8 and later.

  • A Boolean value that indicates whether the calendar item has notes. (read-only)

    Declaration

    Swift

    var hasNotes: Bool { get }

    Objective-C

    @property(nonatomic, readonly) BOOL hasNotes

    Discussion

    If YEStrue, the calendar item has notes; otherwise it does not.

    Availability

    Available in OS X v10.8 and later.

    See Also

    notes

  • The notes associated with the calendar item.

    Declaration

    Swift

    var notes: String?

    Objective-C

    @property(nonatomic, copy) NSString *notes

    Availability

    Available in OS X v10.8 and later.

    See Also

    hasNotes

  • A Boolean value that indicates whether the calendar item has attendees. (read-only)

    Declaration

    Swift

    var hasAttendees: Bool { get }

    Objective-C

    @property(nonatomic, readonly) BOOL hasAttendees

    Discussion

    If YEStrue, the calendar item has attendees; otherwise it does not.

    Availability

    Available in OS X v10.8 and later.

    See Also

    attendees

  • The attendees associated with the calendar item, as an array of EKParticipant objects. (read-only)

    Declaration

    Swift

    var attendees: [EKParticipant]? { get }

    Objective-C

    @property(nonatomic, readonly) NSArray <__kindof EKParticipant *> *attendees

    Discussion

    This property is read-only; it is not possible to add attendees with Event Kit. This property is nil if the calendar item has no attendees.

    Availability

    Available in OS X v10.8 and later.

    See Also

    hasAttendees