Initializer

init(configuration:)

Returns a newly instantiated workout session.

Declaration

init(configuration workoutConfiguration: HKWorkoutConfiguration) throws

Parameters

workoutConfiguration

A workout configuration object containing the configuration data for this workout session.

error

On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing information about the error. Specify nil for this parameter if you do not want to receive error information.

Return Value

A newly initialized workout session object, or nil if an error occurred.

Discussion

HealthKit uses the session’s configuration data to fine tune Apple Watch’s sensors for the selected activity. All workout sessions generate higher-frequency heart rate samples; however, an outdoor cycling activity generates more accurate location data, while an indoor cycling activity does not.

See Also

Deprecated Methods

var activityType: HKWorkoutActivityType

The workout activity performed during this session.

Deprecated
var locationType: HKWorkoutSessionLocationType

A value that indicates whether the workout session occurred indoors or outdoors.

Deprecated