init(recurrenceWith:interval:daysOfTheWeek:daysOfTheMonth:monthsOfTheYear:weeksOfTheYear:daysOfTheYear:setPositions:end:)
Initializes and returns a recurrence rule with a given frequency and additional scheduling information.
Declaration
init(recurrenceWith type: EKRecurrenceFrequency, interval: Int, daysOfTheWeek days: [EKRecurrenceDayOfWeek]?, daysOfTheMonth monthDays: [NSNumber]?, monthsOfTheYear months: [NSNumber]?, weeksOfTheYear: [NSNumber]?, daysOfTheYear: [NSNumber]?, setPositions: [NSNumber]?, end: EKRecurrenceEnd?)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
2occurs every other week. Must be greater than0. - 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
1to31and from-1to-31. This parameter is only valid for recurrence rules of type Monthly. - months:
The months of the year that the event occurs, as an array of
NSNumberobjects. Values can be from1to12. This parameter is only valid for recurrence rules of type Yearly. - weeksOfTheYear:
The weeks of the year that the event occurs, as an array of
NSNumberobjects. Values can be from1to53and from-1to-53. This parameter is only valid for recurrence rules of type Yearly. - daysOfTheYear:
The days of the year that the event occurs, as an array of
NSNumberobjects. Values can be from1to366and from-1to-366. This parameter is only valid for recurrence rules of type Yearly. - 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.
Mentioned in
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.