Drunken Daddy
Drunken Daddy

Reputation: 7991

HealthKit - Get Blood Glucose Meal Time

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

Answers (1)

topolog
topolog

Reputation: 71

It's possible to get it through the metadata property):

let mealtime = sample.metadata?[HKMetadataKeyBloodGlucoseMealTime] as? Int

Upvotes: 3

Related Questions