---
title: "insertRouteData(_:completion:)"
framework: healthkit
role: symbol
role_heading: Instance Method
path: "healthkit/hkworkoutroutebuilder/insertroutedata(_:completion:)"
---

# insertRouteData(_:completion:)

Adds route data to the builder.

## Declaration

```swift
func insertRouteData(_ routeData: [CLLocation], completion: @escaping @Sendable (Bool, (any Error)?) -> Void)
```

```swift
func insertRouteData(_ routeData: [CLLocation]) async throws
```

## Parameters

- `routeData`: An array containing one or more location objects.
- `completion`: A block called after the system adds the collection data to the builder. The system passes the block the following parameters:

## Mentioned in

Creating a workout route

## Discussion

Discussion Use this method to asynchronously add one or more CLLocation objects to the series. The CLLocation objects may be inserted in any order; the builder sorts them by date when finalizing the route.

## See Also

### Building the route

- [finishRoute(with:metadata:completion:)](healthkit/hkworkoutroutebuilder/finishroute(with:metadata:completion:).md)
- [addMetadata(_:completion:)](healthkit/hkworkoutroutebuilder/addmetadata(_:completion:).md)
