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.

  • 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

    - (instancetype)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.

    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: [EKRecurrenceDayOfWeek]?, daysOfTheMonth monthDays: [NSNumber]?, monthsOfTheYear months: [NSNumber]?, weeksOfTheYear weeksOfTheYear: [NSNumber]?, daysOfTheYear daysOfTheYear: [NSNumber]?, setPositions setPositions: [NSNumber]?, end end: EKRecurrenceEnd?)

    Objective-C

    - (instancetype)initRecurrenceWithFrequency:(EKRecurrenceFrequency)type interval:(NSInteger)interval daysOfTheWeek:(NSArray<EKRecurrenceDayOfWeek *> *)days daysOfTheMonth:(NSArray<NSNumber *> *)monthDays monthsOfTheYear:(NSArray<NSNumber *> *)months weeksOfTheYear:(NSArray<NSNumber *> *)weeksOfTheYear daysOfTheYear:(NSArray<NSNumber *> *)daysOfTheYear setPositions:(NSArray<NSNumber *> *)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.

    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

    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

    Availability

    Available in iOS 4.0 and later.

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

    Declaration

    Swift

    var frequency: EKRecurrenceFrequency { get }

    Objective-C

    @property(nonatomic, readonly) EKRecurrenceFrequency frequency

    Availability

    Available in iOS 4.0 and later.

  • 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

    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

    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: [EKRecurrenceDayOfWeek]? { get }

    Objective-C

    @property(nonatomic, readonly) NSArray <EKRecurrenceDayOfWeek *> *daysOfTheWeek

    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: [NSNumber]? { get }

    Objective-C

    @property(nonatomic, readonly) NSArray <NSNumber *> *daysOfTheMonth

    Discussion

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

    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: [NSNumber]? { get }

    Objective-C

    @property(nonatomic, readonly) NSArray <NSNumber *> *daysOfTheYear

    Discussion

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

    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: [NSNumber]? { get }

    Objective-C

    @property(nonatomic, readonly) NSArray <NSNumber *> *weeksOfTheYear

    Discussion

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

    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: [NSNumber]? { get }

    Objective-C

    @property(nonatomic, readonly) NSArray <NSNumber *> *monthsOfTheYear

    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: [NSNumber]? { get }

    Objective-C

    @property(nonatomic, readonly) NSArray <NSNumber *> *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).

    Availability

    Available in iOS 4.0 and later.

  • Defines frequencies for recurrence rules.

    Declaration

    Swift

    enum EKRecurrenceFrequency : Int { case Daily case Weekly case Monthly case Yearly }

    Objective-C

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

    Constants

    • Daily

      EKRecurrenceFrequencyDaily

      Indicates a daily recurrence rule.

      Available in iOS 4.0 and later.

    • Weekly

      EKRecurrenceFrequencyWeekly

      Indicates a weekly recurrence rule.

      Available in iOS 4.0 and later.

    • Monthly

      EKRecurrenceFrequencyMonthly

      Indicates a monthly recurrence rule.

      Available in iOS 4.0 and later.

    • Yearly

      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

    static var EKSunday: EKWeekday { get } static var EKMonday: EKWeekday { get } static var EKTuesday: EKWeekday { get } static var EKWednesday: EKWeekday { get } static var EKThursday: EKWeekday { get } static var EKFriday: EKWeekday { get } static var EKSaturday: EKWeekday { 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.

      Deprecated in iOS 9.0.

    • EKMonday

      EKMonday

      The value for Monday.

      Available in iOS 4.0 and later.

      Deprecated in iOS 9.0.

    • EKTuesday

      EKTuesday

      The value for Tuesday.

      Available in iOS 4.0 and later.

      Deprecated in iOS 9.0.

    • EKWednesday

      EKWednesday

      The value for Wednesday.

      Available in iOS 4.0 and later.

      Deprecated in iOS 9.0.

    • EKThursday

      EKThursday

      The value for Thursday.

      Available in iOS 4.0 and later.

      Deprecated in iOS 9.0.

    • EKFriday

      EKFriday

      The value for Friday.

      Available in iOS 4.0 and later.

      Deprecated in iOS 9.0.

    • EKSaturday

      EKSaturday

      The value for Saturday.

      Available in iOS 4.0 and later.

      Deprecated in iOS 9.0.