---
title: "end(_:)"
framework: healthkit
role: symbol
role_heading: Instance Method
path: "healthkit/hkhealthstore/end(_:)"
---

# end(_:)

Ends a workout session for the current app.

## Declaration

```swift
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

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, and the system calls the session delegate’s workoutSession(_:didChangeTo:from:date:) method.

## See Also

### Deprecated symbols

- [add(_:to:completion:)](healthkit/hkhealthstore/add(_:to:completion:).md)
- [start(_:)](healthkit/hkhealthstore/start(_:).md)
