---
title: HKWorkoutActivity
framework: healthkit
role: symbol
role_heading: Class
path: healthkit/hkworkoutactivity
---

# HKWorkoutActivity

An object that describes an activity within a longer workout.

## Declaration

```swift
class HKWorkoutActivity
```

## Mentioned in

Dividing a HealthKit workout into activities

## Overview

Overview Workout activity objects partition a workout into a set of separate activities. For example, you can use workout activities to record the swim, bike, and running portions of a multisport event, like a triathlon, or to represent the active and rest periods during interval training. All HKWorkout instances have at least one associated HKWorkoutActivity. If you don’t explicitly set workout activities, HealthKit assigns a workout activity that matches the HKWorkout object’s activity type. For more information, see Dividing a HealthKit workout into activities.

## Topics

### Creating workout activities

- [init(workoutConfiguration:start:end:metadata:)](healthkit/hkworkoutactivity/init(workoutconfiguration:start:end:metadata:).md)

### Accessing workout data

- [uuid](healthkit/hkworkoutactivity/uuid.md)
- [startDate](healthkit/hkworkoutactivity/startdate.md)
- [endDate](healthkit/hkworkoutactivity/enddate.md)
- [duration](healthkit/hkworkoutactivity/duration.md)
- [allStatistics](healthkit/hkworkoutactivity/allstatistics.md)
- [statistics(for:)](healthkit/hkworkoutactivity/statistics(for:).md)
- [metadata](healthkit/hkworkoutactivity/metadata.md)
- [workoutConfiguration](healthkit/hkworkoutactivity/workoutconfiguration.md)
- [workoutEvents](healthkit/hkworkoutactivity/workoutevents.md)

### Accessing zone data

- [zoneGroupsByType](healthkit/hkworkoutactivity/zonegroupsbytype.md)

### Specifying predicate key paths

- [HKPredicateKeyPathWorkoutActivity](healthkit/hkpredicatekeypathworkoutactivity.md)
- [HKPredicateKeyPathWorkoutActivityType](healthkit/hkpredicatekeypathworkoutactivitytype.md)
- [HKPredicateKeyPathWorkoutActivityStartDate](healthkit/hkpredicatekeypathworkoutactivitystartdate.md)
- [HKPredicateKeyPathWorkoutActivityEndDate](healthkit/hkpredicatekeypathworkoutactivityenddate.md)
- [HKPredicateKeyPathWorkoutActivityDuration](healthkit/hkpredicatekeypathworkoutactivityduration.md)
- [HKPredicateKeyPathWorkoutActivityAverageQuantity](healthkit/hkpredicatekeypathworkoutactivityaveragequantity.md)
- [HKPredicateKeyPathWorkoutActivityMaximumQuantity](healthkit/hkpredicatekeypathworkoutactivitymaximumquantity.md)
- [HKPredicateKeyPathWorkoutActivityMinimumQuantity](healthkit/hkpredicatekeypathworkoutactivityminimumquantity.md)
- [HKPredicateKeyPathWorkoutActivitySumQuantity](healthkit/hkpredicatekeypathworkoutactivitysumquantity.md)

### Initializers

- [init(coder:)](healthkit/hkworkoutactivity/init(coder:).md)
- [init(workoutConfiguration:startDate:endDate:metadata:)](healthkit/hkworkoutactivity/init(workoutconfiguration:startdate:enddate:metadata:).md)

### Instance Methods

- [zoneGroup(for:)](healthkit/hkworkoutactivity/zonegroup(for:).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)
- [HKWorkoutBuilder](healthkit/hkworkoutbuilder.md)
- [HKWorkoutType](healthkit/hkworkouttype.md)
- [HKWorkoutTypeIdentifier](healthkit/hkworkouttypeidentifier.md)
- [HKWorkoutActivityType](healthkit/hkworkoutactivitytype.md)
- [HKWorkoutSessionType](healthkit/hkworkoutsessiontype.md)
- [HKWorkoutEvent](healthkit/hkworkoutevent.md)
