In this second part of our HealthKit tutorial series, learn how to add workout data to HealthKit!
This is a companion discussion topic for the original entry at http://www.raywenderlich.com/89733/healthkit-tutorial-with-swift-workouts
In this second part of our HealthKit tutorial series, learn how to add workout data to HealthKit!
Hi, i get a lot of errors. I have get an healthkit bundle but it doesnt work. ( xcode 7 )
Best regrads
Hi Ernesto,
Thank you for this very helpful tutorial. I’m new to coding but loving this. I’m trying to edit this (for swift 2.2/xcode 7) to measure/store the user’s average heartrate instead of calorieQuantities.
(From a little research on the web) do I replace your code “HKQuantity(unit: HKUnit.kilocalorieUnit(), doubleValue: kiloCalories)” with
“let heartRateQuantity: HKQuantity = HKQuantity(unit: heartRateUnit, doubleValue: height)”? Or use ‘HKQuantityTypeIdentifierHeartRate’ in some way?
Then in the point 2 (code “totalEnergyBurned: caloriesQuantity”) what class reference do I use instead of “totalEnergyBurned” for average heart rate?
Or how do I code the average as a separate HKStatisticsQuery?