---
title: HKQuantitySeriesSampleQueryDescriptor
framework: healthkit
role: symbol
role_heading: Structure
path: healthkit/hkquantityseriessamplequerydescriptor
---

# HKQuantitySeriesSampleQueryDescriptor

A query interface that reads the series data associated with quantity samples using Swift concurrency.

## Declaration

```swift
struct HKQuantitySeriesSampleQueryDescriptor
```

## Overview

Overview Use HKQuantitySeriesSampleQueryDescriptor to read the series data included in quantity samples. Apps can save any quantity data as a series using the HKQuantitySeriesSampleBuilder class; however, series data typically comes from high-frequency data saved during a workout. Any HKQuantitySample that has a count greater than 1 contains series data. important: Only use this query when you need direct access to the high-frequency series data, for example when visualizing the raw data or when exporting objects from the HealthKit store. For most common calculations, consider using a statistical query instead. Statistical queries correctly handle quantity data, whether the samples represent a single quantity or a series. To read the individual data entries, create a predicate that identifies the sample type and limits the results to the desired data. For example, to read the series for a particular sample object, include a predicateForObject(with:) predicate. However, if you’re reading high-frequency data during a workout, you may want to include a predicateForSamples(withStart:end:options:) predicate that returns matching series data based on the workout’s time period instead. // Create the predicate for the data. let heartRate = HKQuantityType(.heartRate) let objectPredicate = HKQuery.predicateForObject(with: myHeartRateSample.uuid) let predicate = HKSamplePredicate.quantitySample(type: heartRate,                                                  predicate: objectPredicate)

// Create the source descriptor. let seriesDescriptor = HKQuantitySeriesSampleQueryDescriptor(predicate: predicate,                                       options: .orderByQuantitySampleStartDate)

// Get the AsyncSequence that returns the individual data entries. let series = seriesDescriptor.results(for: store)

// Access each data entry in the series for try await entry in series {          // Process results here.     let steps = entry.quantity.doubleValue(for: .count())     print(steps) } While this method returns an AsyncSequence, unlike the long-running queries, this sequence has a finite size. Iterating over the sequence asynchronously returns data entries, automatically terminating after you receive all the data.

## Topics

### Creating Series Query Descriptors

- [init(predicate:options:)](healthkit/hkquantityseriessamplequerydescriptor/init(predicate:options:).md)
- [HKQuantitySeriesSampleQueryDescriptor.Options](healthkit/hkquantityseriessamplequerydescriptor/options-swift.struct.md)

### Running Queries

- [results(for:)](healthkit/hkquantityseriessamplequerydescriptor/results(for:).md)
- [HKQuantitySeriesSampleQueryDescriptor.Results](healthkit/hkquantityseriessamplequerydescriptor/results.md)
- [HKQuantitySeriesSampleQueryDescriptor.Result](healthkit/hkquantityseriessamplequerydescriptor/result.md)

### Accessing Query Properties

- [options](healthkit/hkquantityseriessamplequerydescriptor/options-swift.property.md)
- [predicate](healthkit/hkquantityseriessamplequerydescriptor/predicate.md)

### Default Implementations

- [HKAsyncSequenceQuery Implementations](healthkit/hkquantityseriessamplequerydescriptor/hkasyncsequencequery-implementations.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [Escapable](swift/escapable.md)
- [HKAsyncSequenceQuery](healthkit/hkasyncsequencequery.md)

## See Also

### Series queries

- [HKQuantitySeriesSampleQuery](healthkit/hkquantityseriessamplequery.md)
- [HKWorkoutRouteQueryDescriptor](healthkit/hkworkoutroutequerydescriptor.md)
- [HKWorkoutRouteQuery](healthkit/hkworkoutroutequery.md)
- [HKHeartbeatSeriesQueryDescriptor](healthkit/hkheartbeatseriesquerydescriptor.md)
- [HKHeartbeatSeriesQuery](healthkit/hkheartbeatseriesquery.md)
- [HKElectrocardiogramQueryDescriptor](healthkit/hkelectrocardiogramquerydescriptor.md)
- [HKElectrocardiogramQuery](healthkit/hkelectrocardiogramquery.md)
- [HKWorkoutEffortRelationship](healthkit/hkworkouteffortrelationship.md)
- [HKWorkoutEffortRelationshipQuery](healthkit/hkworkouteffortrelationshipquery.md)
