statistics(for:)
Returns the workout’s statistics for the provided quantity type.
Declaration
func statistics(for quantityType: HKQuantityType) -> HKStatistics?Parameters
- quantityType:
The type of Hkquantitysample objects used to calculate the statistics.
Discussion
HealthKit calculates an HKStatistics object based on the HKQuantitySample objects associated with the workout that also match the specified HKQuantityType.
If there are no matching quantity values, this method returns nil.