Month
Uniquely identifies a month in any calendar system
- iOS
- 16.4+
- macOS
- 13.3+
- tvOS
- 16.4+
- watchOS
- 9.4+
struct Month
Uniquely identifies a month in any calendar system
struct Month
s20FoundationEssentials8CalendarV14RecurrenceRuleV5MonthV
What are these?56HDN
import FoundationEssentials
struct RecurrenceRule
A rule which specifies how often an event should repeat in the future
struct Calendar
Calendar
encapsulates information about systems of reckoning time in which the beginning, length, and divisions of a year are defined. It provides information about the calendar and support for calendrical computations such as determining the range of a given calendrical unit and adding units to a given absolute time.
init(calendar: Calendar, frequency: Calendar.RecurrenceRule.Frequency, interval: Int = 1, end: Calendar.RecurrenceRule.End = .never, matchingPolicy: Calendar.MatchingPolicy = .nextTimePreservingSmallerComponents, repeatedTimePolicy: Calendar.RepeatedTimePolicy = .first, months: [Calendar.RecurrenceRule.Month] = [], daysOfTheYear: [Int] = [], daysOfTheMonth: [Int] = [], weeks: [Int] = [], weekdays: [Calendar.RecurrenceRule.Weekday] = [], hours: [Int] = [], minutes: [Int] = [], seconds: [Int] = [], setPositions: [Int] = [])
init(from decoder: any Decoder) throws
static func daily(calendar: Calendar, interval: Int = 1, end: Calendar.RecurrenceRule.End = .never, matchingPolicy: Calendar.MatchingPolicy = .nextTimePreservingSmallerComponents, repeatedTimePolicy: Calendar.RepeatedTimePolicy = .first, months: [Calendar.RecurrenceRule.Month] = [], daysOfTheMonth: [Int] = [], weekdays: [Calendar.RecurrenceRule.Weekday] = [], hours: [Int] = [], minutes: [Int] = [], seconds: [Int] = [], setPositions: [Int] = []) -> Calendar.RecurrenceRule
A recurrence that repeats every interval
days
static func hourly(calendar: Calendar, interval: Int = 1, end: Calendar.RecurrenceRule.End = .never, matchingPolicy: Calendar.MatchingPolicy = .nextTimePreservingSmallerComponents, repeatedTimePolicy: Calendar.RepeatedTimePolicy = .first, months: [Calendar.RecurrenceRule.Month] = [], daysOfTheYear: [Int] = [], daysOfTheMonth: [Int] = [], weekdays: [Calendar.RecurrenceRule.Weekday] = [], hours: [Int] = [], minutes: [Int] = [], seconds: [Int] = [], setPositions: [Int] = []) -> Calendar.RecurrenceRule
A recurrence that repeats every interval
hours
static func minutely(calendar: Calendar, interval: Int = 1, end: Calendar.RecurrenceRule.End = .never, matchingPolicy: Calendar.MatchingPolicy = .nextTimePreservingSmallerComponents, repeatedTimePolicy: Calendar.RepeatedTimePolicy = .first, months: [Calendar.RecurrenceRule.Month] = [], daysOfTheYear: [Int] = [], daysOfTheMonth: [Int] = [], weekdays: [Calendar.RecurrenceRule.Weekday] = [], hours: [Int] = [], minutes: [Int] = [], seconds: [Int] = [], setPositions: [Int] = []) -> Calendar.RecurrenceRule
A recurrence that repeats every interval
minutes
static func monthly(calendar: Calendar, interval: Int = 1, end: Calendar.RecurrenceRule.End = .never, matchingPolicy: Calendar.MatchingPolicy = .nextTimePreservingSmallerComponents, repeatedTimePolicy: Calendar.RepeatedTimePolicy = .first, months: [Calendar.RecurrenceRule.Month] = [], daysOfTheMonth: [Int] = [], weekdays: [Calendar.RecurrenceRule.Weekday] = [], hours: [Int] = [], minutes: [Int] = [], seconds: [Int] = [], setPositions: [Int] = []) -> Calendar.RecurrenceRule
A recurrence that repeats every interval
months
static func weekly(calendar: Calendar, interval: Int = 1, end: Calendar.RecurrenceRule.End = .never, matchingPolicy: Calendar.MatchingPolicy = .nextTimePreservingSmallerComponents, repeatedTimePolicy: Calendar.RepeatedTimePolicy = .first, months: [Calendar.RecurrenceRule.Month] = [], weekdays: [Calendar.RecurrenceRule.Weekday] = [], hours: [Int] = [], minutes: [Int] = [], seconds: [Int] = [], setPositions: [Int] = []) -> Calendar.RecurrenceRule
A recurrence that repeats every interval
weeks
static func yearly(calendar: Calendar, interval: Int = 1, end: Calendar.RecurrenceRule.End = .never, matchingPolicy: Calendar.MatchingPolicy = .nextTimePreservingSmallerComponents, repeatedTimePolicy: Calendar.RepeatedTimePolicy = .first, months: [Calendar.RecurrenceRule.Month] = [], daysOfTheYear: [Int] = [], daysOfTheMonth: [Int] = [], weeks: [Int] = [], weekdays: [Calendar.RecurrenceRule.Weekday] = [], hours: [Int] = [], minutes: [Int] = [], seconds: [Int] = [], setPositions: [Int] = []) -> Calendar.RecurrenceRule
A recurrence that repeats every interval
years
var calendar: Calendar
The calendar in which the recurrence occurs
var daysOfTheMonth: [Int]
On which days in the month the event should occur
var daysOfTheYear: [Int]
On which days of the year the event may occur.
var end: Calendar.RecurrenceRule.End
For how long the event repeats
var frequency: Calendar.RecurrenceRule.Frequency
How often the event repeats
var hours: [Int]
On which hours of a 24-hour day the event should repeat.
var interval: Int
At what interval to repeat
var matchingPolicy: Calendar.MatchingPolicy
What to do when a recurrence is not a valid date
var minutes: [Int]
On which minutes of the hour the event should repeat. Accepts values between 0 and 59
var months: [Calendar.RecurrenceRule.Month]
On which months the event should occur.
var repeatedTimePolicy: Calendar.RepeatedTimePolicy
What 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 60
var setPositions: [Int]
Which occurrences within every interval should be returned
var weekdays: [Calendar.RecurrenceRule.Weekday]
On which days of the week the event should occur
var weeks: [Int]
On which weeks of the year the event should occur.
func encode(to encoder: any Encoder) throws
func recurrences(of start: Date, in range: Range<Date>? = nil) -> some Sendable & Sequence<Date>
Find recurrences of the given date
struct End
When a recurring event stops recurring
enum Frequency
How often a recurring event repeats
enum Weekday
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol Escapable
protocol ExpressibleByIntegerLiteral
A type that can be initialized with an integer literal.
protocol Sendable
init(_ index: Int, isLeap: Bool = false)
init(from decoder: any Decoder) throws
init(integerLiteral value: Int)
var index: Int
var isLeap: Bool
func encode(to encoder: any Encoder) throws
typealias IntegerLiteralType = Int
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.