---
title: "init(heartbeatSeries:dataHandler:)"
framework: healthkit
role: symbol
role_heading: Initializer
path: "healthkit/hkheartbeatseriesquery/init(heartbeatseries:datahandler:)"
---

# init(heartbeatSeries:dataHandler:)

Creates a new heartbeat series query.

## Declaration

```swift
init(heartbeatSeries: HKHeartbeatSeriesSample, dataHandler: @escaping @Sendable (HKHeartbeatSeriesQuery, TimeInterval, Bool, Bool, (any Error)?) -> Void)
```

## Parameters

- `heartbeatSeries`: The series sample containing the heartbeat data.
- `dataHandler`: The handler called by the query. The handler takes the following parameters:

## Discussion

Discussion The system calls the dataHandler once for each heartbeat until either the done parameter is true, or you call stop(_:).
