---
title: "stopActivity(with:)"
framework: healthkit
role: symbol
role_heading: Instance Method
path: "healthkit/hkworkoutsession/stopactivity(with:)"
---

# stopActivity(with:)

Stops the workout session activity, and sets the end date.

## Declaration

```swift
func stopActivity(with date: Date?)
```

## Parameters

- `date`: The end date for the workout session. This must be equal to or after the start date.

## Mentioned in

Running workout sessions

## See Also

### Related Documentation

- [HKWorkoutSessionState.stopped](healthkit/hkworkoutsessionstate/stopped.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)
- [end()](healthkit/hkworkoutsession/end().md)
