<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKQuantitySeriesSampleQuery/init(quantityType:predicate:quantityHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKQuantitySeriesSampleQuery(im)initWithQuantityType:predicate:quantityHandler:"
  },
  "title" : "init(quantityType:predicate:quantityHandler:)"
}
-->

# init(quantityType:predicate:quantityHandler:)

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

```
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 [`HKQuantitySample`](/documentation/HealthKit/HKQuantitySample), see [`predicateForObject(with:)`](/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 [`stop(_:)`](/documentation/HealthKit/HKHealthStore/stop(_:)) method. The handler takes the following arguments:

- `query`: The query that generated the results.
- `quantity`: The next quantity in the series.
- `dateInterval`: The quantity’s date interval.
- `quantitySample`: The quantity sample that owns the series. This parameter is set to `nil` unless [`includeSample`](/documentation/HealthKit/HKQuantitySeriesSampleQuery/includeSample) is true.
- `done`: A Boolean value that indicates whether you have reached the end of the series.
- `error`: If an error occurs, this parameter describes the error. Otherwise, it is set to `nil`.

## Discussion

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)