Instance Method

averageQuantity(for:)

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

Declaration

func averageQuantity(for source: HKSource) -> HKQuantity?

Parameters

source

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

Return Value

If both the discreteAverage option and the separateBySource 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

func averageQuantity() -> HKQuantity?

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

func maximumQuantity() -> HKQuantity?

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

func maximumQuantity(for: HKSource) -> HKQuantity?

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

func minimumQuantity() -> HKQuantity?

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

func minimumQuantity(for: HKSource) -> HKQuantity?

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

func sumQuantity() -> HKQuantity?

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

func sumQuantity(for: HKSource) -> HKQuantity?

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

func duration() -> HKQuantity?

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

Beta
func duration(for: HKSource) -> HKQuantity?

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

Beta