<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKWorkoutRouteQuery/init(route:dataHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKWorkoutRouteQuery(im)initWithRoute:dataHandler:"
  },
  "title" : "init(route:dataHandler:)"
}
-->

# init(route:dataHandler:)

Creates a new query to access the location data associated with a workout route.

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

## Parameters

`workoutRoute`

The workout route containing the location data.

`dataHandler`

A block called each time the system returns a batch of location data. This block may be called one or more times.

    The block is passed the following parameters:

- `query`: The query that returns the location data.
- `routeData`: A batch of location data, or `nil` if an error has occurred.
- `done`: A Boolean value that indicates whether the query is complete. It is <doc://com.apple.documentation/documentation/Swift/true> if all the location data has been returned. If one or more additional batches of data are still pending, it is <doc://com.apple.documentation/documentation/Swift/false>.
- `error`: An object that describes the error, if an error has occurred; otherwise, `nil`.

## Return Value

A newly initialized route query.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)