Class

HKWorkoutEvent

You can use workout events to toggle a workout object between an active and an inactive state. 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.

Topics

Creating Workout Events

init(type: HKWorkoutEventType, dateInterval: DateInterval, metadata: [String : Any]?)

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

Getting Property Data

var dateInterval: DateInterval

The time and duration of the event.

var type: HKWorkoutEventType

The type of workout event.

var metadata: [String : Any]?

The metadata associated with the workout event.

Constants

enum HKWorkoutEventType

Constants that represent events occurring during a workout.

Deprecated

init(type: HKWorkoutEventType, date: Date)

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

Deprecated
init(type: HKWorkoutEventType, date: Date, metadata: [String : Any])

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

Deprecated
var date: Date

The time when the transition occurred.

Deprecated

Relationships

Inherits From