While working with Apple's HealthKit to read or write health data, I've frequently come across one issue of unit conversion for different type of HKSampleObject.
After fetching healthData in HKQuantitySample type, how to convert it in double or any other type?
In Apple's doc for HKUnit they mention that you can convert it through any SI or non-SI units functionality.
here's some HKQuantitySample with unit conversion:
Note (thanks to ramddy's answer) : You can construct various types of HKUnits using some common class methods made available through HealthKit.
for example you can use:
or: