iOS Developer Library

Developer

EventKit Framework Reference EKEvent Class Reference

Options
Deployment Target:

On This Page
Language:

EKEvent

Conforms To


Import Statement


Swift

import EventKit

Objective-C

@import EventKit;

Availability


Available in iOS 4.0 and later.

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!) -> EKEvent

    Objective-C

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

    Parameters

    eventStore

    The event store to which the event belongs.

    Return Value

    The created event.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    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.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    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.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • startDate startDate Property

    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.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • endDate endDate Property

    The end date for the event.

    Declaration

    Swift

    @NSCopying var endDate: NSDate!

    Objective-C

    @property(nonatomic, copy) NSDate *endDate

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • allDay allDay Property

    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

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • recurrenceRule 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

    Import Statement

    Objective-C

    @import EventKit;

    Availability

    Available in iOS 4.0 through iOS 5.1.

    Deprecated in iOS 5.0.

  • 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.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • organizer organizer Property

    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.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • status status Property

    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.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    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

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 5.0 and later.

  • Compares the start date of the receiving event with the start date of another event.

    Declaration

    Swift

    func compareStartDateWithEvent(_ other: EKEvent!) -> NSComparisonResult

    Objective-C

    - (NSComparisonResult)compareStartDateWithEvent:(EKEvent *)other

    Parameters

    other

    The event to compare against.

    Return Value

    Discussion

    You can pass the selector for this method to the NSArray method sortedArrayUsingSelector: to create an array of events sorted by start date.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • 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.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

Data Types

  • The event’s availability setting for scheduling purposes.

    Declaration

    Swift

    struct EKEventAvailability { init(_ value: Int32) var value: Int32 }

    Objective-C

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

    Constants

    • EKEventAvailabilityNotSupported

      EKEventAvailabilityNotSupported

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

      Available in iOS 4.0 and later.

    • EKEventAvailabilityBusy

      EKEventAvailabilityBusy

      The event has a busy availability setting.

      Available in iOS 4.0 and later.

    • EKEventAvailabilityFree

      EKEventAvailabilityFree

      The event has a free availability setting.

      Available in iOS 4.0 and later.

    • EKEventAvailabilityTentative

      EKEventAvailabilityTentative

      The event has a tentative availability setting.

      Available in iOS 4.0 and later.

    • EKEventAvailabilityUnavailable

      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

    struct EKEventStatus { init(_ value: UInt32) var value: UInt32 }

    Objective-C

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

    Constants

    • EKEventStatusNone

      EKEventStatusNone

      The event has no status.

      Available in iOS 4.0 and later.

    • EKEventStatusConfirmed

      EKEventStatusConfirmed

      The event is confirmed.

      Available in iOS 4.0 and later.

    • EKEventStatusTentative

      EKEventStatusTentative

      The event is tentative.

      Available in iOS 4.0 and later.

    • EKEventStatusCanceled

      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.