Record a physical activity using workout samples.
Framework
- Health
Kit
Overview

Although workouts are saved as HKWorkout
samples, they behave somewhat differently than other sample types.
You do not need a specific type identifier to create the
HKWorkout
instance. All workouts use the same type identifier.Type You must provide an
HKWorkout
value for each workout. This value defines the type of activity performed during the workout.Activity Type After the workout is saved to the HealthKit store, you must associate additional samples with the workout (for example, active energy burned or distance samples). These samples provide fine-grained details about the workout. For more information, see
HKWorkout
.
Workout samples can contribute to the Move and Exercise rings in the Activity app. To contribute, you must associate one or more active energy burned samples with the workout. Additionally:
In watchOS. Use a workout session to track the user’s activity. When the session has ended, create a workout object and the associated active energy burned samples. For more information, see
HKWorkout
.Session The system updates the Move ring based on the active energy burned samples. It updates the Exercise ring based on the amount of time the user spent actually exerting themselves during the workout session, as calculated by the watch’s sensors.
In iOS 10 or later. No additional work is necessary. Workout objects automatically contribute to both the Move and Exercise rings. The Exercise ring is increased by the workout’s total duration, and the Move ring is increased by the number of calories in the associated active energy burned samples. HealthKit also increases the Stand ring by one hour for each wall-clock hour that the workout overlaps.
In iOS 9. Workout objects saved on iPhone do not contribute to the activity rings.
Create and save workouts on the device that makes the most sense for your application. This will typically be the device that is running the logic for the user's workout.
Filling the Rings
Workout samples can contribute to the Move and Exercise rings in the Activity app. To contribute, you must associate one or more active energy burned samples with the workout. Additionally:
In watchOS. Use a workout session to track the user’s activity. When the session has ended, create a workout object and the associated active energy burned samples. For more information, see
HKWorkout
.Session The system updates the Move ring based on the active energy burned samples. It updates the Exercise ring based on the amount of time the user spent actually exerting themselves during the workout session, as calculated by the watch’s sensors.
In iOS 10 or later. No additional work is necessary. Workout objects automatically contribute to both the Move and Exercise rings. The Exercise ring is increased by the workout’s total duration, and the Move ring is increased by the number of calories in the associated active energy burned samples. HealthKit also increases the Stand ring by one hour for each wall-clock hour that the workout overlaps.
In iOS 9. Workout objects saved on iPhone do not contribute to the activity rings.
Create and save workouts on the device that makes the most sense for your application. This will typically be the device that is running the logic for the user's workout.