StructureFoundationEssentials
Calendar.RecurrenceRule
iOS 18.0+
iPadOS 18.0+
Mac Catalyst 18.0+
macOS 15.0+
tvOS 18.0+
watchOS 11.0+
A rule which specifies how often an event should repeat in the future
struct RecurrenceRule
Topics
Structures
struct EndWhen a recurring event stops recurring.struct MonthUniquely identifies a month in any calendar system.
Initializers
Instance Properties
var calendar: CalendarThe calendar in which the recurrence occursvar daysOfTheMonth: [Int]On which days in the month the event should occurvar daysOfTheYear: [Int]On which days of the year the event may occur.var end: Calendar.RecurrenceRule.EndFor how long the event repeatsvar frequency: Calendar.RecurrenceRule.FrequencyHow often the event repeatsvar hours: [Int]On which hours of a 24-hour day the event should repeat.var interval: IntAt what interval to repeatvar matchingPolicy: Calendar.MatchingPolicyWhat to do when a recurrence is not a valid datevar minutes: [Int]On which minutes of the hour the event should repeat. Accepts values between 0 and 59var months: [Calendar.RecurrenceRule.Month]On which months the event should occur.var repeatedTimePolicy: Calendar.RepeatedTimePolicyWhat to do when there are multiple recurrences occurring at the same time of the day but in different time zones due to a daylight saving transition.var seconds: [Int]On which seconds of the minute the event should repeat. Valid values between 0 and 60var setPositions: [Int]Which occurrences within every interval should be returnedvar weekdays: [Calendar.RecurrenceRule.Weekday]On which days of the week the event should occurvar weeks: [Int]On which weeks of the year the event should occur.
Instance Methods
func recurrences(of:in:)Find recurrences of the given date
Type Methods
static func daily(calendar: Calendar, interval: Int, end: Calendar.RecurrenceRule.End, matchingPolicy: Calendar.MatchingPolicy, repeatedTimePolicy: Calendar.RepeatedTimePolicy, months: [Calendar.RecurrenceRule.Month], daysOfTheMonth: [Int], weekdays: [Calendar.RecurrenceRule.Weekday], hours: [Int], minutes: [Int], seconds: [Int], setPositions: [Int]) -> Calendar.RecurrenceRuleA recurrence that repeats everyintervaldaysstatic func hourly(calendar: Calendar, interval: Int, end: Calendar.RecurrenceRule.End, matchingPolicy: Calendar.MatchingPolicy, repeatedTimePolicy: Calendar.RepeatedTimePolicy, months: [Calendar.RecurrenceRule.Month], daysOfTheYear: [Int], daysOfTheMonth: [Int], weekdays: [Calendar.RecurrenceRule.Weekday], hours: [Int], minutes: [Int], seconds: [Int], setPositions: [Int]) -> Calendar.RecurrenceRuleA recurrence that repeats everyintervalhoursstatic func minutely(calendar: Calendar, interval: Int, end: Calendar.RecurrenceRule.End, matchingPolicy: Calendar.MatchingPolicy, repeatedTimePolicy: Calendar.RepeatedTimePolicy, months: [Calendar.RecurrenceRule.Month], daysOfTheYear: [Int], daysOfTheMonth: [Int], weekdays: [Calendar.RecurrenceRule.Weekday], hours: [Int], minutes: [Int], seconds: [Int], setPositions: [Int]) -> Calendar.RecurrenceRuleA recurrence that repeats everyintervalminutesstatic func monthly(calendar: Calendar, interval: Int, end: Calendar.RecurrenceRule.End, matchingPolicy: Calendar.MatchingPolicy, repeatedTimePolicy: Calendar.RepeatedTimePolicy, months: [Calendar.RecurrenceRule.Month], daysOfTheMonth: [Int], weekdays: [Calendar.RecurrenceRule.Weekday], hours: [Int], minutes: [Int], seconds: [Int], setPositions: [Int]) -> Calendar.RecurrenceRuleA recurrence that repeats everyintervalmonthsstatic func weekly(calendar: Calendar, interval: Int, end: Calendar.RecurrenceRule.End, matchingPolicy: Calendar.MatchingPolicy, repeatedTimePolicy: Calendar.RepeatedTimePolicy, months: [Calendar.RecurrenceRule.Month], weekdays: [Calendar.RecurrenceRule.Weekday], hours: [Int], minutes: [Int], seconds: [Int], setPositions: [Int]) -> Calendar.RecurrenceRuleA recurrence that repeats everyintervalweeksstatic func yearly(calendar: Calendar, interval: Int, end: Calendar.RecurrenceRule.End, matchingPolicy: Calendar.MatchingPolicy, repeatedTimePolicy: Calendar.RepeatedTimePolicy, months: [Calendar.RecurrenceRule.Month], daysOfTheYear: [Int], daysOfTheMonth: [Int], weeks: [Int], weekdays: [Calendar.RecurrenceRule.Weekday], hours: [Int], minutes: [Int], seconds: [Int], setPositions: [Int]) -> Calendar.RecurrenceRuleA recurrence that repeats everyintervalyears
Enumerations
enum FrequencyHow often a recurring event repeatsenum Weekday
Default Implementations
Relationships
Conforms To
Swift.CopyableSwift.DecodableSwift.EncodableSwift.EquatableSwift.EscapableSwift.HashableSwift.SendableSwift.SendableMetatype