Workouts and activity rings
Manage workouts, workout sessions, and activity summaries.
Overview
A workout is a sample that contains data about an exercise or fitness activity. You save workout data using the HKWorkout class. In many ways, workouts are identical to any other HealthKit sample—the same advice and APIs apply to both workouts and samples. However, workouts do have a number of unique features, described in HKWorkout.
Workout sessions let you track the user’s activity on Apple Watch. While a workout session is active, your app can continue to run in the background. This lets your app monitor the user and gather data throughout the activity. Additionally, it ensures that your app appears whenever the user checks their watch. After the session ends, your app saves the activity’s data as a workout sample. For more information on setting up and running workout sessions, see HKWorkoutSession.
The Activity Rings display a summary of the user’s daily activity on Apple Watch and in the Activity app. Activity summaries provide access to the data displayed in the user’s Move, Exercise, and Stand rings. To see how your workout samples contribute to these rings, see Fill the Activity rings. To learn more about accessing and displaying activity data in your app, see Activity rings.
Finally, workout routes record the user’s path during an outdoor activity (for example, while walking, running, or cycling). Routes can be associated with a workout sample. For more information, see Creating a workout route and Reading route data.
Topics
Samples
Adding samples to a workoutAccessing condensed workout samplesDividing a HealthKit workout into activitiesHKWorkoutHKWorkoutActivityHKWorkoutBuilderHKWorkoutTypeHKWorkoutTypeIdentifierHKWorkoutActivityTypeHKWorkoutSessionTypeHKWorkoutEvent
Sessions
Running workout sessionsBuild a workout app for Apple WatchBuilding a multidevice workout appBuilding a workout app for iPhone and iPadHKWorkoutSessionHKWorkoutConfigurationHKWorkoutSessionStateHKLiveWorkoutBuilderHKLiveWorkoutDataSource
Activity rings
HKActivitySummaryHKActivitySummaryQueryDescriptorHKActivitySummaryQueryHKActivityRingViewHKActivityMoveModeObject