end(_:)
Ends a workout session for the current app.
Declaration
func end(_ workoutSession: HKWorkoutSession)Parameters
- workoutSession:
A currently running workout session. If the session is not running, the system returns an 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, and the system calls the session delegate’s workoutSession(_:didChangeTo:from:date:) method.