Reputation: 7991
When adding a new blood glucose reading, it's possible to choose Meal Time for the reading. There's picker with three values (Unspecified, Before Meal, After Meal).
I was able to successfully get the reading using:
HKQuantitySample sample = ...
var value = sample.quantity.GetDoubleValue(hkUnit);
But I've no idea how to get the mealtime.
How can I get the meal time using HealthKit Query?
Upvotes: 1
Views: 481
Reputation: 71
It's possible to get it through the metadata property):
let mealtime = sample.metadata?[HKMetadataKeyBloodGlucoseMealTime] as? Int
Upvotes: 3