nextWeekend(startingAfter:start:interval:direction:)
Returns the range of the next weekend via two inout parameters. The weekend starts strictly after the given date.
Declaration
func nextWeekend(startingAfter date: Date, start: inout Date, interval: inout TimeInterval, direction: Calendar.SearchDirection = .forward) -> BoolParameters
- date:
The date at which to begin the search.
- start:
Upon return, the starting time of the calendar component that contains the date.
- interval:
Upon return, the duration of the calendar component that contains the date.
- direction:
Which direction in time to search. The default value is
.forward.
Return Value
false if the calendar and locale do not have the concept of a weekend, otherwise true.
Discussion
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.