Skip to content

Instance Method

dateIntervalOfWeekend(containing:start:interval:)

iOS 8.0+ iPadOS 8.0+ Mac Catalyst 8.0+ macOS 10.10+ tvOS 9.0+ watchOS 2.0+
Find the range of the weekend around the given date, returned via two by-reference parameters.
func dateIntervalOfWeekend(containing date: Date, start: inout Date, interval: inout TimeInterval) -> Bool

Parameters

date

The date at which to start the search.

start

Upon return, the starting date of the weekend if found.

interval

Upon return, the duration of the weekend if found.

Return Value

true if a date range could be found, and false if the date is not in a weekend.

Discussion

Note that a given entire day within a calendar is not necessarily all in a weekend or not; weekends can start in the middle of a day in some calendars and locales.

See Also

dateIntervalOfWeekend(containing:)