iOS Developer Library

Developer

EventKit Framework Reference EKEvent Class Reference

Options
Deployment Target:

On This Page
Language:

EKEvent

An instance of the EKEvent class represents an event added to a calendar in the Event Kit framework.

Use the eventWithEventStore: method to create a new event. Use the properties in the class to get and modify certain information about an event. Other properties, such as the event’s title and calendar, are inherited from the parent class EKCalendarItem.

  • Creates and returns a new event belonging to a specified event store.

    Declaration

    Swift

    init(eventStore eventStore: EKEventStore)

    Objective-C

    + (EKEvent *)eventWithEventStore:(EKEventStore *)eventStore

    Parameters

    eventStore

    The event store to which the event belongs.

    Return Value

    The created event.

    Availability

    Available in iOS 4.0 and later.

  • A unique identifier for the event. (read-only)

    Declaration

    Swift

    var eventIdentifier: String { get }

    Objective-C

    @property(nonatomic, readonly) NSString *eventIdentifier

    Discussion

    You can use this identifier to look up an event with the EKEventStore method eventWithIdentifier:.

    If the calendar of an event changes, its identifier most likely changes as well.

    Availability

    Available in iOS 4.0 and later.

  • The availability setting for the event.

    Declaration

    Swift

    var availability: EKEventAvailability

    Objective-C

    @property(nonatomic) EKEventAvailability availability

    Discussion

    This setting is used by CalDAV and Exchange servers to indicate how the event should be treated for scheduling purposes.

    If the event’s calendar does not support availability settings, this property’s value is EKEventAvailabilityNotSupported.

    Availability

    Available in iOS 4.0 and later.

  • The start date of the event.

    Declaration

    Swift

    @NSCopying var startDate: NSDate

    Objective-C

    @property(nonatomic, copy) NSDate *startDate

    Discussion

    Floating events such as all-day events are returned in the default time zone.

    Availability

    Available in iOS 4.0 and later.

  • The end date for the event.

    Declaration

    Swift

    @NSCopying var endDate: NSDate

    Objective-C

    @property(nonatomic, copy) NSDate *endDate

    Availability

    Available in iOS 4.0 and later.

  • A Boolean value that indicates whether the event is an all-day event.

    Declaration

    Swift

    var allDay: Bool

    Objective-C

    @property(nonatomic, getter=isAllDay) BOOL allDay

    Availability

    Available in iOS 4.0 and later.

  • recurrenceRule Available in iOS 4.0 through iOS 5.1 Property

    The recurrence rule associated with the event.

    Deprecation Statement

    As of iOS 4.0 and later and OS X 10.8 and later, use the EKRecurrenceRule class to specify repeating events.

    Declaration

    Objective-C

    @property(nonatomic, retain) EKRecurrenceRule *recurrenceRule

    Availability

    Available in iOS 4.0 through iOS 5.1.

    Deprecated in iOS 5.0.

  • The original occurrence date of an event if it is part of a recurring series. (read-only)

    Declaration

    Swift

    var occurrenceDate: NSDate { get }

    Objective-C

    @property(nonatomic, readonly) NSDate *occurrenceDate

    Discussion

    This value will remain the same even if the event has been detached and its start date has changed. Floating events (such as all-day events) are returned in the default time zone.

    Special Considerations

    This property is not available on iOS.

    Availability

    Available in iOS 9.0 and later.

  • A Boolean value that indicates whether an event is a detached instance of a repeating event. (read-only)

    Declaration

    Swift

    var isDetached: Bool { get }

    Objective-C

    @property(nonatomic, readonly) BOOL isDetached

    Discussion

    This value is YEStrue if and only if the event is part of a repeating event and one or more of its attributes have been modified from the repeating event’s default attributes.

    Availability

    Available in iOS 4.0 and later.

  • The organizer associated with the event. (read-only)

    Declaration

    Swift

    var organizer: EKParticipant? { get }

    Objective-C

    @property(nonatomic, readonly) EKParticipant *organizer

    Discussion

    This property is nil if the event has no organizer.

    Availability

    Available in iOS 4.0 and later.

  • The status of the event. (read-only)

    Declaration

    Swift

    var status: EKEventStatus { get }

    Objective-C

    @property(nonatomic, readonly) EKEventStatus status

    Discussion

    You should act based on an event’s status only if the status is EKEventStatusCanceled, which indicates that the event has been canceled. Other statuses should be considered informational.

    Availability

    Available in iOS 4.0 and later.

    See Also

    EKEventStatus

  • The Address Book framework record identifier of the person for this birthday event. (read-only)

    Declaration

    Swift

    var birthdayPersonID: Int { get }

    Objective-C

    @property(nonatomic, readonly) NSInteger birthdayPersonID

    Discussion

    This property is only set if this is a birthday event; otherwise the property is nil.

    Special Considerations

    Availability

    Available in iOS 5.0 and later.

    Deprecated in iOS 9.0.

  • Updates the event’s data with the current information in the Calendar database.

    Declaration

    Swift

    func refresh() -> Bool

    Objective-C

    - (BOOL)refresh

    Return Value

    If the event was successfully refreshed, YEStrue; otherwise, NOfalse.

    Discussion

    You should call this method only on events that your application is editing, and only when your application receives the EKEventStoreChangedNotification notification. If this method returns NOfalse, the event has been deleted or otherwise invalidated, and you should not continue to use it.

    This method does not replace the values of any properties that you have modified.

    Availability

    Available in iOS 4.0 and later.

Data Types

  • The event’s availability setting for scheduling purposes.

    Declaration

    Swift

    enum EKEventAvailability : Int { case NotSupported case Busy case Free case Tentative case Unavailable }

    Objective-C

    typedef enum { EKEventAvailabilityNotSupported = -1, EKEventAvailabilityBusy = 0, EKEventAvailabilityFree, EKEventAvailabilityTentative, EKEventAvailabilityUnavailable } EKEventAvailability;

    Constants

    • NotSupported

      EKEventAvailabilityNotSupported

      Availability settings are not supported by the event’s calendar.

      Available in iOS 4.0 and later.

    • Busy

      EKEventAvailabilityBusy

      The event has a busy availability setting.

      Available in iOS 4.0 and later.

    • Free

      EKEventAvailabilityFree

      The event has a free availability setting.

      Available in iOS 4.0 and later.

    • Tentative

      EKEventAvailabilityTentative

      The event has a tentative availability setting.

      Available in iOS 4.0 and later.

    • Unavailable

      EKEventAvailabilityUnavailable

      The event has an unavailable availability setting.

      Available in iOS 4.0 and later.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • The event’s status.

    Declaration

    Swift

    enum EKEventStatus : Int { case None case Confirmed case Tentative case Canceled }

    Objective-C

    typedef enum { EKEventStatusNone = 0, EKEventStatusConfirmed, EKEventStatusTentative, EKEventStatusCanceled, } EKEventStatus;

    Constants

    • None

      EKEventStatusNone

      The event has no status.

      Available in iOS 4.0 and later.

    • Confirmed

      EKEventStatusConfirmed

      The event is confirmed.

      Available in iOS 4.0 and later.

    • Tentative

      EKEventStatusTentative

      The event is tentative.

      Available in iOS 4.0 and later.

    • Canceled

      EKEventStatusCanceled

      The event is canceled.

      Available in iOS 4.0 and later.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.