<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKWorkoutSessionDelegate",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(pl)HKWorkoutSessionDelegate"
  },
  "title" : "HKWorkoutSessionDelegate"
}
-->

# HKWorkoutSessionDelegate

The session delegate protocol that defines an interface for receiving notifications about errors and changes in the workout session’s state.

```
protocol HKWorkoutSessionDelegate : NSObjectProtocol
```

## Overview

All the methods are required. HealthKit calls these methods on an anonymous serial background queue.

## Topics

### Tracking workout sessions

[`workoutSession(_:didChangeTo:from:date:)`](/documentation/HealthKit/HKWorkoutSessionDelegate/workoutSession(_:didChangeTo:from:date:))

Tells the delegate that the session’s state changed.

[`workoutSession(_:didFailWithError:)`](/documentation/HealthKit/HKWorkoutSessionDelegate/workoutSession(_:didFailWithError:))

Tells the delegate that the session failed with an error.

[`workoutSession(_:didGenerate:)`](/documentation/HealthKit/HKWorkoutSessionDelegate/workoutSession(_:didGenerate:))

Tells the delegate that the system generated a workout event.

[`workoutSession(_:didBeginActivityWith:date:)`](/documentation/HealthKit/HKWorkoutSessionDelegate/workoutSession(_:didBeginActivityWith:date:))

Tells the delegate that a new workout session began.

[`workoutSession(_:didEndActivityWith:date:)`](/documentation/HealthKit/HKWorkoutSessionDelegate/workoutSession(_:didEndActivityWith:date:))

Tells the session that the current workout activity ended.

### Working with mirrored sessions

[`workoutSession(_:didDisconnectFromRemoteDeviceWithError:)`](/documentation/HealthKit/HKWorkoutSessionDelegate/workoutSession(_:didDisconnectFromRemoteDeviceWithError:))

Tells the delegate that the mirrored workout session disconnected from the primary session.

[`workoutSession(_:didReceiveDataFromRemoteWorkoutSession:)`](/documentation/HealthKit/HKWorkoutSessionDelegate/workoutSession(_:didReceiveDataFromRemoteWorkoutSession:))

Passes data from the remote workout session to the session delegate.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)