nextWeekend(startingAfter:start:interval:direction:)

Returns the range of the next weekend via two inout parameters. The weekend starts strictly after the given date.

iOS
8.0+
macOS
10.10+
tvOS
9.0+
watchOS
2.0+
func nextWeekend(startingAfter date: Date, start: inout Date, interval: inout TimeInterval, direction: Calendar.SearchDirection = .forward) -> Bool

Parameters

date

The date at which to begin the search.

start

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

interval

Upon return, the duration of the next weekend if found.

direction

Which direction in time to search. The default value is .forward.

Returns

true if the next weekend is found.

If direction is .backward, then finds the previous weekend range strictly before the given date.

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.