Is there a way to read the Action button of the Apple Watch Ultra in SwiftUI?
You can read the Digital Crown like in the example below, but I've found nothing similar for the Action button?
struct DigitalCrown: View {
@State private var crownValue = 0.0
var body: some View {
Text("Received Value:\(crownValue, specifier: "%.1f")")
.focusable()
.digitalCrownRotation($crownValue)
}
}
The Apple Watch Ultra’s Action Button is powered by new App Intents APIs. You will be able to build your own apps to integrate with it, like a hockey app that uses the button to record goals. And for users, the button can kick off any Shortcut you want.
To use this, make an Intent that conforms to the StarWorkoutIntent protocol: https://developer.apple.com/documentation/appintents/startworkoutintent
These APIs are meant for Workout apps, so to put this new button in a mode where it’s controlling your app, you’ll need to at least start with a StartWorkoutIntent.
Once you’re done with that, you can create an AppIntent result with an actionButtonIntent to set the next thing the button will do, to any other intent. Or, if you’re changing the button’s behavior based on something that happened in your app’s UI, you can use donations to do so.