<!--
{
  "availability" : [
    "watchOS: 2.0.0 - 5.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKHealthStore/end(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKHealthStore(im)endWorkoutSession:"
  },
  "title" : "end(_:)"
}
-->

# end(_:)

Ends a workout session for the current app.

```
func end(_ workoutSession: HKWorkoutSession)
```

## Parameters

`workoutSession`

A currently running workout session. If the session is not running,  the system returns an <doc://com.apple.documentation/documentation/Foundation/NSExceptionName/invalidArgumentException> exception.

## Discussion

This method returns immediately; however, the work is performed asynchronously on an anonymous serial background queue. If successful, the session’s state transitions to [`HKWorkoutSessionState.ended`](/documentation/HealthKit/HKWorkoutSessionState/ended), and the system calls the session delegate’s [`workoutSession(_:didChangeTo:from:date:)`](/documentation/HealthKit/HKWorkoutSessionDelegate/workoutSession(_:didChangeTo:from:date:)) method.

---

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)