Contents

PauseWorkoutIntent

An App Intent that lets someone pause your app’s current workout session.

Declaration

protocol PauseWorkoutIntent : SystemIntent

Mentioned in

Overview

On Apple Watch Ultra, someone can pause your workout by simultaneously pressing the Action button and the side button while your app is running a workout session.

To implement the pause action, create a structure that adopts the PauseWorkoutIntent protocol.

struct MyPauseWorkoutIntent: PauseWorkoutIntent {
   static var title: LocalizedStringResource = "Pause Workout"

   func perform() async throws -> some IntentResult {
       logger.debug("*** Performing a pause intent. ***")
       await MyWorkoutManager.shared.pauseWorkout()
       return .result()
   }
}

This intent needs a title property that provides a localized description of the action, and a perform() method, which the system calls when it triggers the intent.

For more information, see Responding to the Action button on Apple Watch Ultra.

See Also

Responding to the Action button