Instance Method
nextWeekend(startingAfter:start:interval:direction:)
iOS 8.0+
iPadOS 8.0+
Mac Catalyst 8.0+
macOS 10.10+
tvOS 9.0+
watchOS 2.0+
Returns the range of the next weekend via two inout parameters. The weekend starts strictly after the given date.
func nextWeekend(startingAfter date: Date, start: inout Date, interval: inout TimeInterval, direction: Calendar.SearchDirection = .forward) -> Bool
Parameters
dateThe date at which to begin the search.
startUpon return, the starting date of the next weekend if found.
intervalUpon return, the duration of the next weekend if found.
directionWhich direction in time to search. The default value is
.forward.
Return Value
true if the next weekend is found.
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.