---
title: "init(route:dateInterval:dataHandler:)"
framework: healthkit
role: symbol
role_heading: Initializer
path: "healthkit/hkworkoutroutequery/init(route:dateinterval:datahandler:)"
---

# init(route:dateInterval:dataHandler:)

Creates a new query to access the location data associated with a workout route during the specified date interval.

## Declaration

```swift
init(route workoutRoute: HKWorkoutRoute, dateInterval: DateInterval, dataHandler: @escaping @Sendable (HKWorkoutRouteQuery, [CLLocation]?, Bool, (any Error)?) -> Void)
```

## Parameters

- `workoutRoute`: The workout route that contains the location data.
- `dateInterval`: The date interval for the requested location data. If the date interval doesn’t overlap with the specified workout, this query returns an empty array. If the date interval only partially overlaps the specified workout, the query only returns location data from the overlapping time period.
- `dataHandler`: A block that the system calls each time it returns a batch of location data. The system may call this block more than once. The system passes this block the following parameters:

## See Also

### Creating route queries

- [init(route:dataHandler:)](healthkit/hkworkoutroutequery/init(route:datahandler:).md)
