---
title: "nextDate(after:matching:options:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nscalendar/nextdate(after:matching:options:)"
---

# nextDate(after:matching:options:)

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

## Declaration

```swift
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 doc://com.apple.foundation/documentation/Foundation/NSCalendar/Options.

## Return Value

Return Value A new NSDate object.

## Discussion

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

- [startOfDay(for:)](foundation/nscalendar/startofday(for:).md)
- [enumerateDates(startingAfter:matching:options:using:)](foundation/nscalendar/enumeratedates(startingafter:matching:options:using:).md)
- [nextDate(after:matchingHour:minute:second:options:)](foundation/nscalendar/nextdate(after:matchinghour:minute:second:options:).md)
- [nextDate(after:matching:value:options:)](foundation/nscalendar/nextdate(after:matching:value:options:).md)
- [NSCalendar.Options](foundation/nscalendar/options.md)
- [NSWrapCalendarComponents](foundation/nswrapcalendarcomponents-api.md)
