How can I get swimming pool length from the HealthKit?

73 Views Asked by At

screenshotImage

I can get swimming distance data and swimming stroke count data.. But I can't get swimming pool length data.. How can I get the swimming pool length?

...
guard let distance = workout.statistics(for: .init(.distanceSwimming)),
      let meter = distance.sumQuantity()?.doubleValue(for: HKUnit.meter()),
      let sampleType = HKSampleType.quantityType(forIdentifier: .swimmingStrokeCount)
...
1

There are 1 best solutions below

5
Fogmeister On

From here...

https://developer.apple.com/documentation/healthkit/hkmetadatakeyswimmingstrokestyle

It looks like there is a key HKMetadataKeyLapLength that would be the pool length.