Query ECG individual voltage measurement values

I'm trying to get the individual voltage measurements of an ECG back from Apple HealthKit using new APIs in iOS 14.

I've already managed to use:
Code Block
let ecgQuery = HKSampleQuery(sampleType: HKObjectType.electrocardiogramType(), predicate: samplePredicate, limit: 0, sortDescriptors: [sortDescriptor]){ (query, results, error) in

which gets me a HKElectrocardiogram object. From this I can see the average heart rate, ECG classification etc...

I now believe I need to pass that object into an HKElectrocardiogramQuery like this:
Code Block
let ecgSample = HKElectrocardiogramQuery(ecg) { (query, result) in

but I can't find any way to extract data from the result data handler. If I put a print in on result, it executes many times but again, I can't extract the data. result is of type HKElectrocardiogramQuery.Result

The documentations pretty sketchy on Apple's developer site with zero examples provided. Any help would be very appreciated.

Cheers
Answered by simonfromhelix in 626980022
Query ECG individual voltage measurement values
 
 
Q