Instance Method

startWatchApp(with:completion:)

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

Declaration

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

Parameters

workoutConfiguration

The configuration data for a new workout session on the watch.

completion

A block that this method calls after launching the Watch app. This block is passed the following parameters:

success

A Boolean value. This parameter contains true if the watch app launched successfully; otherwise, false.

error

An error object. If an error occurred, this object contains information about the error; otherwise, it is set to nil.

Discussion

Use this method to launch the Watch app on a paired Apple Watch. After launching, the Watch app calls the WKExtensionDelegate object’s handle(_:) method and passes the provided workout configuration. Use the workout configuration to start a new workout session on the watch.

See Also

Managing Workout Sessions

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
func end(HKWorkoutSession)

Ends a workout session for the current app.

Deprecated