<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 10.10.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKWorkoutSessionDelegate/workoutSession(_:didChangeTo:from:date:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(pl)HKWorkoutSessionDelegate(im)workoutSession:didChangeToState:fromState:date:"
  },
  "title" : "workoutSession(_:didChangeTo:from:date:)"
}
-->

# workoutSession(_:didChangeTo:from:date:)

Tells the delegate that the session’s state changed.

```
func workoutSession(_ workoutSession: HKWorkoutSession, didChangeTo toState: HKWorkoutSessionState, from fromState: HKWorkoutSessionState, date: Date)
```

## Parameters

`workoutSession`

The workout session that changed.

`toState`

The session’s new state. For a list of possible values, see [`HKWorkoutSessionState`](/documentation/HealthKit/HKWorkoutSessionState).

`fromState`

The session’s previous state. For a list of possible values, see [`HKWorkoutSessionState`](/documentation/HealthKit/HKWorkoutSessionState).

`date`

A date object indicating when the state change occurred.

## Discussion

If your application is suspended, the delegate receives this call after the application resumes. This means you may receive the notification long after the state changed. Check the `date` parameter to determine when the state change actually occurred.

For a list of possible session states, see [`HKWorkoutSessionState`](/documentation/HealthKit/HKWorkoutSessionState).

---

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)