A builder object that constructs a workout incrementally based on live data from an active workout session.


class HKLiveWorkoutBuilder : HKWorkoutBuilder


Configuring a Live Workout Buidler.

var dataSource: HKLiveWorkoutDataSource?

A data source that provides live data from a workout session automatically.

class HKLiveWorkoutDataSource

A data source that automatically provides live data from an active workout session.

var workoutSession: HKWorkoutSession?

The workout session created by the data source and associated with this builder.

Monitoring and Controlling the Workout

var delegate: HKLiveWorkoutBuilderDelegate?

The live builder’s delegate.

protocol HKLiveWorkoutBuilderDelegate

A protocol for monitoring live workout builders.

var shouldCollectWorkoutEvents: Bool

A Boolean value that determines whether the workout builder adds samples generated by the workout session automatically.

Accessing Data

var elapsedTime: TimeInterval

The elapsed time for the workout based on the builder's current contents, including pauses.


Inherits From

Conforms To

See Also

Workout Builder

class HKWorkoutBuilder

A builder object that constructs a workout incrementally.

SpeedySloth: Creating a Workout

Use the Workout Builder API to start, stop, and to save workouts on Apple Watch.