HealthKit Plugin
Connect your web app to Apple HealthKit and read health data with user permission on iOS.
Activate HealthKit features by setting static let HealthKitEnabled in Config.swift to your plugin token and adding the HealthKit capability.
Contact [email protected] for details.
API Usage (once activated):
Read a HealthKit value by calling readhealthkit:// followed by a HealthKit identifier. The result is injected into your web app as a JavaScript variable named after the identifier (containing value and unit as a string):
<a href="readhealthkit://HKQuantityTypeIdentifierStepCount" onclick="setTimeout(function(){ alert(HKQuantityTypeIdentifierStepCount); }, 500)">Read step count</a>
Write a HealthKit value using the writehealthkit://Identifier//Value syntax:
<a href="writehealthkit://HKQuantityTypeIdentifierStepCount//100">Save 100 steps</a>
Note: Requires the HealthKit capability and the Privacy - Health Share Usage Description / Privacy - Health Update Usage Description entries in Info.plist.