A sample that contains a workout’s route data.
- iOS 11.0+
- Mac Catalyst 13.0+
- watchOS 4.0+
When creating a workout route, you do not instantiate the
HKWorkout objects directly. Instead, create a
HKWorkout object, and provide it with location data throughout the workout. After the workout ends, call the route builder’s
finish method to create the route. For detailed instructions, see Creating a Workout Route.
The route’s location data is stored as an array of
CLLocation objects. Because the route may contain a large number of location objects, use a
HKWorkout object to asynchronously read the location data from the HealthKit store in batches. For more information, see Reading Route Data.