# Creating Recurring Events

Recurring events repeat over a specified interval of time. To make an event a recurring event, assign it a recurrence rule, which describes when the event occurs. Recurrence rules are represented by instances of the `EKRecurrenceRule`

class.

Recurrence is applicable to both calendar events and reminders. Unlike with recurring events, only the first incomplete reminder of a recurring set is obtainable. This is true with Event Kit as well as the Reminders app. When the reminder is completed, the next reminder in the recurrence set becomes available.

## Using Basic Rules

You can create a recurrence rule with a simple daily, weekly, monthly, or yearly pattern using the `initRecurrenceWithFrequency:interval:end:`

method. You provide three values to this method:

**The recurrence frequency**. This is a value of type`EKRecurrenceFrequency`

that indicates whether the recurrence rule is daily, weekly, monthly, or yearly.**The recurrence interval**. This is an integer greater than 0 that specifies how often a pattern repeats. For example, if the recurrence rule is a weekly recurrence rule and its interval is`1`

, then the pattern repeats every week. If the recurrence rule is a monthly recurrence rule and its interval is`3`

, then the pattern repeats every three months.**The recurrence end**. This optional parameter is an instance of the`EKRecurrenceEnd`

class, which indicates when the recurrence rule ends. The recurrence end can be based on a specific end date or on an amount of occurrences.If you don’t want to specify an end for the recurrence rule, pass

`nil`

.

## Using Complex Rules

You can create a recurrence rule with a complex pattern using the `initRecurrenceWithFrequency:interval:daysOfTheWeek:daysOfTheMonth:monthsOfTheYear:weeksOfTheYear:daysOfTheYear:setPositions:end:`

method. As you do for a basic recurrence rule, you provide a frequency, an interval, and an optional end for the recurring event. In addition, you can provide a combination of optional values describing a custom rule, as listed in Table 4-1.

Parameter name | Accepted values | Can be combined with | Example |
---|---|---|---|

The days of the week on which the event occurs. | An array of | All recurrence rules except for daily recurrence rules. | An array containing |

The days of the month on which the event occurs. | An array of nonzero | Monthly recurrence rules only. | An array containing the values |

The months of the year in which the event occurs. | An array of | Yearly recurrence rules only. | If your originating event occurs on January 10, you can provide an array containing the values |

The weeks of the year in which the event occurs. | An array of nonzero | Yearly recurrence rules only. | If your originating event occurs on a Wednesday, you can provide an array containing the values |

The days of the year on which the event occurs. | An array of nonzero | Yearly recurrence rules only. | You can provide an array containing the values |

The occurrences to include in the recurrence rule. This filter is applied to the set of occurrences determined from the other parameters you provide. | An array of nonzero | All recurrence rules except for daily recurrence rules. | If you provide an array containing the values |

You can provide values for any number of the parameters in Table 4-1. Parameters that don’t apply to a particular recurrence rule are ignored. If you provide a value for more than one of the above parameters, the recurrence occurs only on days that apply to all provided values.

Once you have created a recurrence rule, you can apply it to a calendar event or reminder with the `addRecurrenceRule:`

instance method of `EKCalendarItem`

.

Copyright © 2012 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2012-07-17