I am using this code to save heart rate value to the Healthkit.
let heartRateCountUnit = HKUnit.count() let beatsPerMinuteQuantity = HKQuant