---
title: HKWorkoutSession
framework: healthkit
role: symbol
role_heading: Class
path: healthkit/hkworkoutsession
---

# HKWorkoutSession

A session that tracks a person’s workout.

## Declaration

```swift
class HKWorkoutSession
```

## Mentioned in

Running workout sessions

## Overview

Overview The session fine-tunes Apple Watch’s sensors for the specified activity. All workout sessions generate high-frequency heart rate samples; however, an outdoor cycling activity generates accurate location data, while an indoor cycling activity doesn’t. Collecting heart rate data on iPhone or iPad requires pairing with an external heart rate sensor because these devices don’t have one. iPhone and iPad can collect various workout metrics, but the system may generate different samples than those specifically requested by an app. You can modify the default types of data collected during a workout. After someone saves a workout, you can access and display summary statistics or chart metrics over time. iPhone typically locks during workouts. For privacy reasons, health data usually isn’t accessible while the device is locked. However, the system can prompt someone to provide your app access to workout data even when their device is locked. You can then display Live Activities on the Lock Screen, providing health metrics without requiring the person to unlock their phone. Siri support extends to the Lock Screen, allowing people to start, pause, resume, or cancel workouts hands-free. You can integrate Siri intents into your apps to enable this functionality. Apple Watch runs one workout session at a time. If a second workout starts while your workout is running, your HKWorkoutSessionDelegate object receives an HKError.Code.errorAnotherWorkoutSessionStarted error, and your session ends.

## Topics

### Creating workout sessions

- [init(healthStore:configuration:)](healthkit/hkworkoutsession/init(healthstore:configuration:).md)

### Monitoring the session

- [delegate](healthkit/hkworkoutsession/delegate.md)
- [HKWorkoutSessionDelegate](healthkit/hkworkoutsessiondelegate.md)

### Accessing the workout builder

- [associatedWorkoutBuilder()](healthkit/hkworkoutsession/associatedworkoutbuilder().md)

### Managing the workout

- [prepare()](healthkit/hkworkoutsession/prepare().md)
- [startActivity(with:)](healthkit/hkworkoutsession/startactivity(with:).md)
- [pause()](healthkit/hkworkoutsession/pause().md)
- [resume()](healthkit/hkworkoutsession/resume().md)
- [stopActivity(with:)](healthkit/hkworkoutsession/stopactivity(with:).md)
- [end()](healthkit/hkworkoutsession/end().md)

### Working with remote workout sessions

- [startMirroringToCompanionDevice(completion:)](healthkit/hkworkoutsession/startmirroringtocompaniondevice(completion:).md)
- [stopMirroringToCompanionDevice(completion:)](healthkit/hkworkoutsession/stopmirroringtocompaniondevice(completion:).md)
- [sendToRemoteWorkoutSession(data:completion:)](healthkit/hkworkoutsession/sendtoremoteworkoutsession(data:completion:).md)

### Accessing session data

- [endDate](healthkit/hkworkoutsession/enddate.md)
- [startDate](healthkit/hkworkoutsession/startdate.md)
- [state](healthkit/hkworkoutsession/state.md)
- [type](healthkit/hkworkoutsession/type.md)
- [workoutConfiguration](healthkit/hkworkoutsession/workoutconfiguration.md)

### Managing workout activities

- [currentActivity](healthkit/hkworkoutsession/currentactivity.md)
- [beginNewActivity(configuration:date:metadata:)](healthkit/hkworkoutsession/beginnewactivity(configuration:date:metadata:).md)
- [endCurrentActivity(on:)](healthkit/hkworkoutsession/endcurrentactivity(on:).md)

### Deprecated methods

- [init(activityType:locationType:)](healthkit/hkworkoutsession/init(activitytype:locationtype:).md)
- [init(configuration:)](healthkit/hkworkoutsession/init(configuration:).md)
- [activityType](healthkit/hkworkoutsession/activitytype.md)
- [locationType](healthkit/hkworkoutsession/locationtype.md)

### Initializers

- [init(coder:)](healthkit/hkworkoutsession/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)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Sessions

- [Running workout sessions](healthkit/running-workout-sessions.md)
- [Build a workout app for Apple Watch](healthkit/build-a-workout-app-for-apple-watch.md)
- [Building a multidevice workout app](healthkit/building-a-multidevice-workout-app.md)
- [Building a workout app for iPhone and iPad](healthkit/building-a-workout-app-for-iphone-and-ipad.md)
- [HKWorkoutConfiguration](healthkit/hkworkoutconfiguration.md)
- [HKWorkoutSessionState](healthkit/hkworkoutsessionstate.md)
- [HKLiveWorkoutBuilder](healthkit/hkliveworkoutbuilder.md)
- [HKLiveWorkoutBuilderDelegate](healthkit/hkliveworkoutbuilderdelegate.md)
- [HKLiveWorkoutDataSource](healthkit/hkliveworkoutdatasource.md)
