Skip to content

Instantly share code, notes, and snippets.

@FedeRotoli
Last active January 23, 2020 15:04
Show Gist options
  • Save FedeRotoli/60670b3726e5fd6e5edc2492e802a055 to your computer and use it in GitHub Desktop.
Save FedeRotoli/60670b3726e5fd6e5edc2492e802a055 to your computer and use it in GitHub Desktop.
private func process(_ samples: [HKQuantitySample], type: HKQuantityTypeIdentifier) {
var lastHeartRate = 0.0
for sample in samples {
if type == .heartRate {
lastHeartRate = sample.quantity.doubleValue(for: heartRateQuantity)
}
self.value = Int(lastHeartRate)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment