---
title: "init(quantityType:predicate:quantityHandler:)"
framework: healthkit
role: symbol
role_heading: Initializer
path: "healthkit/hkquantityseriessamplequery/init(quantitytype:predicate:quantityhandler:)"
---

# init(quantityType:predicate:quantityHandler:)

Creates a new query for a series of the specified quantity type.

## Declaration

```swift
init(quantityType: HKQuantityType, predicate: NSPredicate?, quantityHandler: @escaping @Sendable (HKQuantitySeriesSampleQuery, HKQuantity?, DateInterval?, HKQuantitySample?, Bool, (any Error)?) -> Void)
```

## Parameters

- `quantityType`: The quantity type.
- `predicate`: A predicate used to filter the results. To query for all the quantity objects for a specific doc://com.apple.healthkit/documentation/HealthKit/HKQuantitySample, see doc://com.apple.healthkit/documentation/HealthKit/HKQuery/predicateForObject(with:).
- `quantityHandler`: A handler called by the query with the results. The query calls the block multiple times until either the done parameter is doc://com.apple.documentation/documentation/Foundation/NSExpression/true, or you call the HealthKit store’s doc://com.apple.healthkit/documentation/HealthKit/HKHealthStore/stop(_:) method. The handler takes the following arguments:

## Discussion

Discussion HealthKit returns quantities in ascending order, based on their start date.

## See Also

### Creating a Series Query

- [includeSample](healthkit/hkquantityseriessamplequery/includesample.md)
- [orderByQuantitySampleStartDate](healthkit/hkquantityseriessamplequery/orderbyquantitysamplestartdate.md)
