Contents

nextDate(after:matching:options:)

Returns the next date after a given date matching the given components.

Declaration

func nextDate(after date: Date, matching comps: DateComponents, options: NSCalendar.Options = []) -> Date?

Parameters

  • date:

    The date for which to perform the calculation.

  • comps:

    The date components to match.

  • options:

    Options for the calculation. For possible values, see Options.

Return Value

A new NSDate object.

Discussion

To compute a sequence of dates, use the enumerateDates(startingAfter:matching:options:using:) method instead of calling this method in a loop with the previous loop iteration’s result.

See Also

Scanning Dates