---
title: statistics()
framework: healthkit
role: symbol
role_heading: Instance Method
path: healthkit/hkstatisticscollection/statistics()
---

# statistics()

Returns an array of statistics objects representing the populated time intervals covered by the statistics collection query.

## Declaration

```swift
func statistics() -> [HKStatistics]
```

## Return Value

Return Value An array of statistics objects. The statistics objects are sorted in chronological order.

## Discussion

Discussion The resulting array contains a statistics object for each time interval that has at least one sample that matches the query. The statistics objects are returned in chronological order, but they are not necessarily contiguous. This method ignores time intervals that do not have any samples. As a result, there may be arbitrarily large gaps in time between adjacent statistics objects in the array.

## See Also

### Accessing Statistics Collections

- [statistics(for:)](healthkit/hkstatisticscollection/statistics(for:).md)
- [enumerateStatistics(from:to:with:)](healthkit/hkstatisticscollection/enumeratestatistics(from:to:with:).md)
