Contents

HKWorkoutBuilder

A builder object that incrementally constructs a workout.

Declaration

class HKWorkoutBuilder

Overview

Incrementally collect samples and events associated with a workout. When the workout ends, call finishWorkout(completion:) to create an HKWorkout sample and save it to the HealthKit store.

For watchOS, use an HKWorkoutSession and an HKLiveWorkoutBuilder instead.

Topics

Creating the builder

Starting the workout

Associating samples with the workout

Adding metadata to the workout

Adding events to the workout

Managing workout activities

Ending the workout

Accessing workout statistics

See Also

Samples