Instance Method

averageQuantityForSource:

Returns the average value from all the samples that match the query and that were created by the specified source.

Declaration

- (HKQuantity *)averageQuantityForSource:(HKSource *)source;

Parameters

source

A data source from the statistics object’s sources array.

Return Value

If both the HKStatisticsOptionDiscreteAverage option and the HKStatisticsOptionSeparateBySource option were set, this method returns a quantity object. This object contains the average value from all the samples that match the query and that were created by the specified source. If the statistics options were not both set, this method returns nil

See Also

Getting Statistics Data

- averageQuantity

Returns the average value from all the samples that match the query.

- maximumQuantity

Returns the maximum value from all the samples that match the query.

- maximumQuantityForSource:

Returns the maximum value from all the samples that match the query and that were created by the specified source.

- minimumQuantity

Returns the minimum value from all the samples that match the query.

- minimumQuantityForSource:

Returns the minimum value from all the samples that match the query and that were created by the specified source.

- sumQuantity

Returns the sum of all the samples that match the query.

- sumQuantityForSource:

Returns the sum of all the samples that match the query and that were created by the specified source.

- duration

Returns the total duration covering all the samples that match the query.

- durationForSource:

Returns the total duration covering all the samples created by the specified source that also match the query.