I have a question about how a watch widget can access HealthKit data. Does it, as the large model mentioned, share data through an App Group, or does it directly access the HealthStore?
widget can access HealthKit data?
Yes, a widget can access the Health store on the device directly, in case the main app gets the user authorization.
Best,
——
Ziqiao Chen
Worldwide Developer Relations.
Just want to expand a bit on the answer here.
Yes Widgets can access the Health store. However, you need other remember that the Health store is only available when the device is unlocked. I will list a few limitations that come to mind from this.
There's currently no way to request widget timeline updates only when the device is unlocked.
There's currently no way to get reliable updates for iPhone widgets mirrored on Mac that include Health data, these will only update when the user unlocks their iPhone.
Widgets on the iPhone Lock Screen can only update their Health data when the device is unlocked, this means if you're displaying a step count for example, it won't update throughout the day automatically. The same also applies to widgets in the Standby mode on iPhone.
I've previously posted multiple feedback regarding this. The latest one is FB13879739 although it was closed... maybe we'll see some improvements here one day.