Contents

sources()

Returns a set containing all the sources that had samples matched by the statistics collection query.

Declaration

func sources() -> Set<HKSource>

Return Value

A set of sources if the separateBySource option was specified; otherwise, it returns nil.

Discussion

If the separateBySource option was set, each of the statistics objects returned by the statistics collection also has a sources array. The statistic object’s array should contain a subset of the sources returned by this method. Specifically, it contains only those sources that contributed samples to that particular statistics object. You can use the source objects in these arrays to request source-specific statistical data.

See Also

Related Documentation