WIP
This commit is contained in:
@@ -177,11 +177,13 @@ extension WatchMainViewModel: HKWorkoutSessionDelegate, HKLiveWorkoutBuilderDele
|
|||||||
}
|
}
|
||||||
switch quantityType {
|
switch quantityType {
|
||||||
case HKQuantityType.quantityType(forIdentifier: .heartRate):
|
case HKQuantityType.quantityType(forIdentifier: .heartRate):
|
||||||
|
DispatchQueue.main.async() {
|
||||||
let statistics = workoutBuilder.statistics(for: quantityType)
|
let statistics = workoutBuilder.statistics(for: quantityType)
|
||||||
let heartRateUnit = HKUnit.count().unitDivided(by: HKUnit.minute())
|
let heartRateUnit = HKUnit.count().unitDivided(by: HKUnit.minute())
|
||||||
let value = statistics!.mostRecentQuantity()?.doubleValue(for: heartRateUnit)
|
let value = statistics!.mostRecentQuantity()?.doubleValue(for: heartRateUnit)
|
||||||
heartValue = Int(Double(round(1 * value!) / 1))
|
self.heartValue = Int(Double(round(1 * value!) / 1))
|
||||||
print("[workoutBuilder] Heart Rate: \(String(describing: heartValue))")
|
print("[workoutBuilder] Heart Rate: \(String(describing: self.heartValue))")
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user