iOS Developer Library

Developer

EventKit Framework Reference EKRecurrenceRule Class Reference

Options
Deployment Target:

On This Page
Language:

EKRecurrenceRule

The EKRecurrenceRule class is used to describe the recurrence pattern for a recurring event.

After you create a recurrence rule, assign it to an event with the recurrenceRule method of EKEvent.

Recurrence rules can have an end, represented by an EKRecurrenceEnd object. The end can be based on a specific date or a maximum number of occurrences.

Inheritance


Conforms To


Import Statement


Swift

import EventKit

Objective-C

@import EventKit;

Availability


Available in iOS 4.0 and later.
  • Initializes and returns a simple recurrence rule with a given frequency, interval, and end.

    Declaration

    Swift

    init!(recurrenceWithFrequency type: EKRecurrenceFrequency, interval interval: Int, end end: EKRecurrenceEnd!)

    Objective-C

    - (id)initRecurrenceWithFrequency:(EKRecurrenceFrequency)type interval:(NSInteger)interval end:(EKRecurrenceEnd *)end

    Parameters

    type

    The frequency of the recurrence rule. Can be daily, weekly, monthly, or yearly.

    interval

    The interval between instances of this recurrence. For example, a weekly recurrence rule with an interval of 2 occurs every other week. Must be greater than 0.

    end

    The end of the recurrence rule.

    Return Value

    The initialized recurrence rule, or nil if invalid values are provided.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • Initializes and returns a recurrence rule with a given frequency and additional scheduling information.

    Declaration

    Swift

    init!(recurrenceWithFrequency type: EKRecurrenceFrequency, interval interval: Int, daysOfTheWeek days: [AnyObject]!, daysOfTheMonth monthDays: [AnyObject]!, monthsOfTheYear months: [AnyObject]!, weeksOfTheYear weeksOfTheYear: [AnyObject]!, daysOfTheYear daysOfTheYear: [AnyObject]!, setPositions setPositions: [AnyObject]!, end end: EKRecurrenceEnd!)

    Objective-C

    - (id)initRecurrenceWithFrequency:(EKRecurrenceFrequency)type interval:(NSInteger)interval daysOfTheWeek:(NSArray *)days daysOfTheMonth:(NSArray *)monthDays monthsOfTheYear:(NSArray *)months weeksOfTheYear:(NSArray *)weeksOfTheYear daysOfTheYear:(NSArray *)daysOfTheYear setPositions:(NSArray *)setPositions end:(EKRecurrenceEnd *)end

    Parameters

    type

    The frequency of the recurrence rule. Can be daily, weekly, monthly, or yearly.

    interval

    The interval between instances of this recurrence. For example, a weekly recurrence rule with an interval of 2 occurs every other week. Must be greater than 0.

    days

    The days of the week that the event occurs, as an array of EKRecurrenceDayOfWeek objects.

    monthDays

    The days of the month that the event occurs, as an array of NSNumber objects. Values can be from 1 to 31 and from -1 to -31. This parameter is only valid for recurrence rules of type EKRecurrenceFrequencyMonthly.

    months

    The months of the year that the event occurs, as an array of NSNumber objects. Values can be from 1 to 12. This parameter is only valid for recurrence rules of type EKRecurrenceFrequencyYearly.

    weeksOfTheYear

    The weeks of the year that the event occurs, as an array of NSNumber objects. Values can be from 1 to 53 and from -1 to -53. This parameter is only valid for recurrence rules of type EKRecurrenceFrequencyYearly.

    daysOfTheYear

    The days of the year that the event occurs, as an array of NSNumber objects. Values can be from 1 to 366 and from -1 to -366. This parameter is only valid for recurrence rules of type EKRecurrenceFrequencyYearly.

    setPositions

    An array of ordinal numbers that filters which recurrences to include in the recurrence rule’s frequency. See setPositions for more information.

    end

    The end of the recurrence rule.

    Return Value

    The initialized recurrence rule, or nil if invalid values are provided.

    Discussion

    Negative values indicate counting backwards from the end of the recurrence rule’s frequency.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • The identifier for the recurrence rule’s calendar. (read-only)

    Declaration

    Swift

    var calendarIdentifier: String! { get }

    Objective-C

    @property(nonatomic, readonly) NSString *calendarIdentifier

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • Indicates when the recurrence rule ends. This can be represented by an end date or a number of occurrences.

    Declaration

    Swift

    @NSCopying var recurrenceEnd: EKRecurrenceEnd!

    Objective-C

    @property(nonatomic, copy) EKRecurrenceEnd *recurrenceEnd

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • frequency frequency Property

    The frequency of the recurrence rule. (read-only)

    Declaration

    Swift

    var frequency: EKRecurrenceFrequency { get }

    Objective-C

    @property(nonatomic, readonly) EKRecurrenceFrequency frequency

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • interval interval Property

    Specifies how often the recurrence rule repeats over the unit of time indicated by its frequency. For example, a recurrence rule with a frequency type of EKRecurrenceFrequencyWeekly and an interval of 2 repeats every two weeks. (read-only)

    Declaration

    Swift

    var interval: Int { get }

    Objective-C

    @property(nonatomic, readonly) NSInteger interval

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • Indicates which day of the week the recurrence rule treats as the first day of the week. Values of 1 to 7 correspond to Sunday through Saturday. A value of 0 indicates that this property is not set for the recurrence rule. (read-only)

    Declaration

    Swift

    var firstDayOfTheWeek: Int { get }

    Objective-C

    @property(nonatomic, readonly) NSInteger firstDayOfTheWeek

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • The days of the week associated with the recurrence rule, as an array of EKRecurrenceDayOfWeek objects. This property value is valid only for recurrence rules that were initialized with specific days of the week and a frequency type of EKRecurrenceFrequencyWeekly, EKRecurrenceFrequencyMonthly, or EKRecurrenceFrequencyYearly. (read-only)

    Declaration

    Swift

    var daysOfTheWeek: [AnyObject]! { get }

    Objective-C

    @property(nonatomic, readonly) NSArray *daysOfTheWeek

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • The days of the month associated with the recurrence rule, as an array of NSNumber objects. Values can be from 1 to 31 and from -1 to -31.This property value is valid only for recurrence rules that were initialized with specific days of the month and a frequency type of EKRecurrenceFrequencyMonthly. (read-only)

    Declaration

    Swift

    var daysOfTheMonth: [AnyObject]! { get }

    Objective-C

    @property(nonatomic, readonly) NSArray *daysOfTheMonth

    Discussion

    Negative values indicate counting backwards from the end of the month.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • The days of the year associated with the recurrence rule, as an array of NSNumber objects. Values can be from 1 to 366 and from -1 to -366. This property value is valid only for recurrence rules initialized with a frequency type of EKRecurrenceFrequencyYearly. (read-only)

    Declaration

    Swift

    var daysOfTheYear: [AnyObject]! { get }

    Objective-C

    @property(nonatomic, readonly) NSArray *daysOfTheYear

    Discussion

    Negative values indicate counting backwards from the end of the year.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • The weeks of the year associated with the recurrence rule, as an array of NSNumber objects. Values can be from 1 to 53 and from -1 to -53. This property value is valid only for recurrence rules initialized with specific weeks of the year and a frequency type of EKRecurrenceFrequencyYearly. (read-only)

    Declaration

    Swift

    var weeksOfTheYear: [AnyObject]! { get }

    Objective-C

    @property(nonatomic, readonly) NSArray *weeksOfTheYear

    Discussion

    Negative values indicate counting backwards from the end of the year.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • The months of the year associated with the recurrence rule, as an array of NSNumber objects. Values can be from 1 to 12. This property value is valid only for recurrence rules initialized with specific months of the year and a frequency type of EKRecurrenceFrequencyYearly. (read-only)

    Declaration

    Swift

    var monthsOfTheYear: [AnyObject]! { get }

    Objective-C

    @property(nonatomic, readonly) NSArray *monthsOfTheYear

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • An array of ordinal numbers that filters which recurrences to include in the recurrence rule’s frequency. For example, a yearly recurrence rule that has a daysOfTheWeek value that specifies Monday through Friday, and a setPositions array containing 2 and -1, occurs only on the second weekday and last weekday of every year. (read-only)

    Declaration

    Swift

    var setPositions: [AnyObject]! { get }

    Objective-C

    @property(nonatomic, readonly) NSArray *setPositions

    Discussion

    Values can be from 1 to 366 and from -1 to -366.

    Negative values indicate counting backwards from the end of the recurrence rule’s frequency (week, month, or year).

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • Defines frequencies for recurrence rules.

    Declaration

    Swift

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

    Objective-C

    typedef enum { EKRecurrenceFrequencyDaily, EKRecurrenceFrequencyWeekly, EKRecurrenceFrequencyMonthly, EKRecurrenceFrequencyYearly } EKRecurrenceFrequency;

    Constants

    • EKRecurrenceFrequencyDaily

      EKRecurrenceFrequencyDaily

      Indicates a daily recurrence rule.

      Available in iOS 4.0 and later.

    • EKRecurrenceFrequencyWeekly

      EKRecurrenceFrequencyWeekly

      Indicates a weekly recurrence rule.

      Available in iOS 4.0 and later.

    • EKRecurrenceFrequencyMonthly

      EKRecurrenceFrequencyMonthly

      Indicates a monthly recurrence rule.

      Available in iOS 4.0 and later.

    • EKRecurrenceFrequencyYearly

      EKRecurrenceFrequencyYearly

      Indicates a yearly recurrence rule.

      Available in iOS 4.0 and later.

    Import Statement

    Objective-C

    @import EventKit;

    Swift

    import EventKit

    Availability

    Available in iOS 4.0 and later.

  • Defines values for the days of the week.

    Declaration

    Swift

    var EKSunday: Int { get } var EKMonday: Int { get } var EKTuesday: Int { get } var EKWednesday: Int { get } var EKThursday: Int { get } var EKFriday: Int { get } var EKSaturday: Int { get }

    Objective-C

    enum { EKSunday = 1, EKMonday, EKTuesday, EKWednesday, EKThursday, EKFriday, EKSaturday };

    Constants

    • EKSunday

      EKSunday

      The value for Sunday.

      Available in iOS 4.0 and later.

    • EKMonday

      EKMonday

      The value for Monday.

      Available in iOS 4.0 and later.

    • EKTuesday

      EKTuesday

      The value for Tuesday.

      Available in iOS 4.0 and later.

    • EKWednesday

      EKWednesday

      The value for Wednesday.

      Available in iOS 4.0 and later.

    • EKThursday

      EKThursday

      The value for Thursday.

      Available in iOS 4.0 and later.

    • EKFriday

      EKFriday

      The value for Friday.

      Available in iOS 4.0 and later.

    • EKSaturday

      EKSaturday

      The value for Saturday.

      Available in iOS 4.0 and later.