HealthKit - accumulate energy burned in watchOS 4

593 views Asked by At

In watchOS 3, when you wanted to accumulate energy burned, you could use something like:

totalEnergyBurned.addQuantities(from: samples, unit: HKUnit.calorie())

Now in WatchOS 4, HKUnit.calorie() is deprecated and has been replaced by HKUnit.smallCalorie() and HKUnit.largeCalorie().

So, to measure the energy burned now, do we accumulate smallCalorie(), largeCalorie() or both?

Unfortunately the Apple documentation today is still in BETA and doesn't tell us much yet.

1

There are 1 answers

0
Tamás Sengel On BEST ANSWER

According to Apple's documentation, HKUnit.calorie() represents gram calorie. You should use smallCalorie (a.k.a. gram calorie) for the same purpose.

largeCalorie = smallCalorie * 1000