iOS Developer Library

Developer

EventKit Framework Reference EKCalendar Class Reference

Options
Deployment Target:

On This Page
Language:

EKCalendar

Inherits From


Conforms To


Import Statement


Swift

import EventKit

Objective-C

@import EventKit;

Availability


Available in iOS 4.0 and later

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.

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

    Declaration

    Objective-C

    + (EKCalendar *)calendarWithEventStore:(EKEventStore *)eventStore

    Parameters

    eventStore

    The event store to which the event belongs.

    Return Value

    The created calendar.

    Import Statement

    Objective-C

    @import EventKit;

    Availability

    Available in iOS 4.0 and later

    Deprecated in iOS 6.0

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

    Declaration

    Swift

    init!(forEntityType entityType: EKEntityType, eventStore eventStore: EKEventStore!) -> EKCalendar

    Objective-C

    + (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.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 6.0 and later

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

    Declaration

    Swift

    var allowsContentModifications: Bool { get }

    Objective-C

    @property(nonatomic, readonly) BOOL allowsContentModifications

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later

  • CGColor CGColor Property

    The calendar’s color.

    Declaration

    Swift

    var CGColor: CGColor!

    Objective-C

    @property(nonatomic) CGColorRef CGColor

    Special Considerations

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

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later

  • immutable immutable Property

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

    Declaration

    Swift

    var immutable: Bool { get }

    Objective-C

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

    Discussion

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

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 5.0 and later

  • title title Property

    The calendar’s title.

    Declaration

    Swift

    var title: String!

    Objective-C

    @property(nonatomic, copy) NSString *title

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later

  • type type Property

    The calendar’s type. (read-only)

    Declaration

    Swift

    var type: EKCalendarType { get }

    Objective-C

    @property(nonatomic, readonly) EKCalendarType type

    Discussion

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

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later

    See Also

    EKCalendarType

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

    Declaration

    Swift

    var allowedEntityTypes: EKEntityMask { get }

    Objective-C

    @property(nonatomic, readonly) EKEntityMask allowedEntityTypes

    Discussion

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

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 6.0 and later

  • source source Property

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

    Declaration

    Swift

    var source: EKSource!

    Objective-C

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

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 5.0 and later

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

    Declaration

    Swift

    var subscribed: Bool { get }

    Objective-C

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

    Discussion

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

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 5.0 and later

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

    Declaration

    Swift

    var supportedEventAvailabilities: EKCalendarEventAvailabilityMask { get }

    Objective-C

    @property(nonatomic, readonly) EKCalendarEventAvailabilityMask supportedEventAvailabilities

    Discussion

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

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later

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

    Declaration

    Swift

    var calendarIdentifier: String! { get }

    Objective-C

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

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 5.0 and later

Data Types

  • Possible calendar types.

    Declaration

    Swift

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

    Objective-C

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

    Constants

    • EKCalendarTypeLocal

      EKCalendarTypeLocal

      A local calendar.

      Available in iOS 4.0 and later

    • EKCalendarTypeCalDAV

      EKCalendarTypeCalDAV

      A CalDAV or iCloud calendar.

      Available in iOS 4.0 and later

    • EKCalendarTypeExchange

      EKCalendarTypeExchange

      An Exchange calendar.

      Available in iOS 4.0 and later

    • EKCalendarTypeSubscription

      EKCalendarTypeSubscription

      A locally subscribed calendar.

      Available in iOS 4.0 and later

    • EKCalendarTypeBirthday

      EKCalendarTypeBirthday

      A birthday calendar.

      Available in iOS 4.0 and later

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later

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

    Declaration

    Swift

    typealias EKCalendarEventAvailabilityMask = Int

    Objective-C

    typedef NSUInteger EKCalendarEventAvailabilityMask;

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later

  • Event availability settings that the calendar can support.

    Declaration

    Swift

    var EKCalendarEventAvailabilityNone: Int { get } var EKCalendarEventAvailabilityBusy: Int { get } var EKCalendarEventAvailabilityFree: Int { get } var EKCalendarEventAvailabilityTentative: Int { get } var EKCalendarEventAvailabilityUnavailable: Int { get }

    Objective-C

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

    Constants

    • EKCalendarEventAvailabilityNone

      EKCalendarEventAvailabilityNone

      The calendar does not support event availability settings.

      Available in iOS 4.0 and later

    • EKCalendarEventAvailabilityBusy

      EKCalendarEventAvailabilityBusy

      The calendar supports the busy event availability setting.

      Available in iOS 4.0 and later

    • EKCalendarEventAvailabilityFree

      EKCalendarEventAvailabilityFree

      The calendar supports the free event availability setting.

      Available in iOS 4.0 and later

    • EKCalendarEventAvailabilityTentative

      EKCalendarEventAvailabilityTentative

      The calendar supports the tentative event availability setting.

      Available in iOS 4.0 and later

    • EKCalendarEventAvailabilityUnavailable

      EKCalendarEventAvailabilityUnavailable

      The calendar supports the unavailable event availability setting.

      Available in iOS 4.0 and later