Instance Method

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.

See Also

Managing Workout Sessions

func startWatchApp(with: HKWorkoutConfiguration, completion: (Bool, Error?) -> Void)

Launches or wakes the Watch app to create a new workout session.

func start(HKWorkoutSession)

Starts a workout session for the current app.

Deprecated
func pause(HKWorkoutSession)

Pauses the provided workout session.

Deprecated
func resumeWorkoutSession(HKWorkoutSession)

Resumes the provided workout session.

Deprecated