A sample that contains a workout’s route data.
SDKs
- iOS 11.0+
- Mac Catalyst 13.0+
- watchOS 4.0+
Framework
- Health
Kit
Declaration
class HKWorkoutRoute : HKSeries Sample
Overview
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.
Using Workout Routes
Like many HealthKit classes, the HKWorkout
class should not be subclassed. You can extend HKWorkout
objects by adding custom metadata keys and values to the metadata dictionary when the object is created.