Class

HKWorkoutEvent

An object representing an important event during a workout.

Declaration

@interface HKWorkoutEvent : NSObject

Overview

You can use workout events to toggle a workout between an active and an inactive state, or to mark points of interest during a workout.

Workouts start in an active state. A pause event switches it to an inactive state; a resume event switches it back to an active state. Adding a pause event when the workout is already inactive, or a resume event when the workout is already active, does not affect the workout’s state. These events are ignored.

The lap, segment, and marker events are used to identify periods of interest during a workout. Use lap events to partition a workout into segments of equal distance. Segment events mark important periods during the workout, while markers identify important points in time.

Topics

Creating Workout Events

+ workoutEventWithType:dateInterval:metadata:

Instantiates and returns a new workout event with the specified type, date interval, and metadata.

Getting Property Data

dateInterval

The time and duration of the event.

type

The type of workout event.

metadata

The metadata associated with the workout event.

Determining the Event Type

HKWorkoutEventType

Constants that represent events occurring during a workout.

Deprecated

+ workoutEventWithType:date:

Instantiates and returns a new workout event with the specified type and date.

Deprecated
+ workoutEventWithType:date:metadata:

Instantiates and returns a new workout event with the specified type, date, and metadata.

Deprecated
date

The time when the transition occurred.

Deprecated

Relationships

Inherits From

See Also

Samples

Using Workout Samples

Record a physical activity using workout samples.

HKWorkout

A workout sample stores information about a single physical activity.

HKWorkoutBuilder

A builder object that incrementally constructs a workout.

HKWorkoutType

A type that identifies samples that store information about a workout.

HKWorkoutTypeIdentifier

The workout type identifier.

HKWorkoutActivityType

The type of activity performed during a workout.