---
title: "enumerateStatistics(from:to:with:)"
framework: healthkit
role: symbol
role_heading: Instance Method
path: "healthkit/hkstatisticscollection/enumeratestatistics(from:to:with:)"
---

# enumerateStatistics(from:to:with:)

Enumerates the statistics objects for all the time intervals from the start date until the end date.

## Declaration

```swift
func enumerateStatistics(from startDate: Date, to endDate: Date, with block: @escaping (HKStatistics, UnsafeMutablePointer<ObjCBool>) -> Void)
```

## Parameters

- `startDate`: The start date for the calculation. The initial statistics come from the time interval that contains the start date.
- `endDate`: The end date for the calculation. The final statistics come from the time interval that contains the end date.
- `block`: A block that is called once for each time interval. This method passes the following parameters to the block:

## Discussion

Discussion This method enumerates the statistics in chronological order. It calls the block once for each time interval between the start and end dates. If there are no samples for a particular time interval, the corresponding statistic object has a nil-valued quantity.

## See Also

### Accessing Statistics Collections

- [statistics()](healthkit/hkstatisticscollection/statistics().md)
- [statistics(for:)](healthkit/hkstatisticscollection/statistics(for:).md)
