---
title: HKWorkoutEvent
framework: healthkit
role: symbol
role_heading: Class
path: healthkit/hkworkoutevent
---

# HKWorkoutEvent

An object representing an important event during a workout.

## Declaration

```swift
class HKWorkoutEvent
```

## Overview

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

- [init(type:dateInterval:metadata:)](healthkit/hkworkoutevent/init(type:dateinterval:metadata:).md)

### Getting property data

- [dateInterval](healthkit/hkworkoutevent/dateinterval.md)
- [type](healthkit/hkworkoutevent/type.md)
- [metadata](healthkit/hkworkoutevent/metadata.md)

### Determining the event type

- [HKWorkoutEventType](healthkit/hkworkouteventtype.md)

### Deprecated

- [init(type:date:)](healthkit/hkworkoutevent/init(type:date:).md)
- [init(type:date:metadata:)](healthkit/hkworkoutevent/init(type:date:metadata:).md)
- [date](healthkit/hkworkoutevent/date.md)

### Initializers

- [init(coder:)](healthkit/hkworkoutevent/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Samples

- [Adding samples to a workout](healthkit/adding-samples-to-a-workout.md)
- [Accessing condensed workout samples](healthkit/accessing-condensed-workout-samples.md)
- [Dividing a HealthKit workout into activities](healthkit/dividing-a-healthkit-workout-into-activities.md)
- [HKWorkout](healthkit/hkworkout.md)
- [HKWorkoutActivity](healthkit/hkworkoutactivity.md)
- [HKWorkoutBuilder](healthkit/hkworkoutbuilder.md)
- [HKWorkoutType](healthkit/hkworkouttype.md)
- [HKWorkoutTypeIdentifier](healthkit/hkworkouttypeidentifier.md)
- [HKWorkoutActivityType](healthkit/hkworkoutactivitytype.md)
- [HKWorkoutSessionType](healthkit/hkworkoutsessiontype.md)
