How can I record a HKWorkoutSession primarily on the iPhone and mirror it on the Apple Watch

In the wwdc2023-10023 session, we go over how the Apple Watch can be used as a primary workout session manager and the iPhone as the mirrored one. How is it possible to create a workout session on the iPhone and optionally mirror it to the Apple Watch to collect heart rate data?

In iOS 17, I still cannot instantiate a HKWorkoutSession, I'm assuming it says it's available because we can have an instance of it as a mirrored copy from the Apple Watch. I find it odd that the iPhone cannot manage the primary session. I hope I'm missing something.

Post not yet marked as solved Up vote post of hatchfactory Down vote post of hatchfactory
443 views

Replies

Live workout sessions are only available on watchOS and not on iOS. As you've noted, iOS can mirror watch workout sessions now. But the watch continues to remain the main device for workouts.

How would you want your phone app to manage the main workout session? Curious what functionality/use case is missing from the way things are currently structured.

  • My use case would be to serve iPhone customers. I'm not sure if it's possible to build a workout recording and display some metrics to the users such as energy burned, time elapsed etc. Cant find a tutorial on this.

Add a Comment

I'm using the phone (mounted on the handlebar) to track cycling speed, orientation, incline, steering, technique and other metrics. The only metric I will need from the watch is the Heart Rate. I'm already connecting to other heart rate devices via Bluetooth and I don't want the Apple Watch to be a requirement for my users.