<!--
{
  "availability" : [
    "iOS: 15.4.0 -",
    "iPadOS: 15.4.0 -",
    "macCatalyst: 15.4.0 -",
    "macOS: 13.0.0 -",
    "visionOS: -",
    "watchOS: 8.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKAsyncSequenceQuery/results(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "s:9HealthKit20HKAsyncSequenceQueryP7results3for0D0QzSo13HKHealthStoreC_tF"
  },
  "title" : "results(for:)"
}
-->

# results(for:)

Initiates a query that returns its results using an asynchronous sequence.

```
func results(for healthStore: HKHealthStore) -> Self.Sequence
```

## Parameters

`healthStore`

The access point for HealthKit data.

## Discussion

The adopting type’s [`Sequence`](/documentation/HealthKit/HKAsyncSequenceQuery/Sequence) associated type specifies the type of <doc://com.apple.documentation/documentation/Swift/AsyncSequence> that this method returns. For example, the [`HKAnchoredObjectQueryDescriptor`](/documentation/HealthKit/HKAnchoredObjectQueryDescriptor) returns a sequence of [`HKAnchoredObjectQueryDescriptor.Result`](/documentation/HealthKit/HKAnchoredObjectQueryDescriptor/Result) instances.

```swift
let anchorDescriptor =
HKAnchoredObjectQueryDescriptor(
    predicates: [.workout()],
    anchor: anchor)

let updateQueue = anchorDescriptor.results(for: store)

updateTask = Task {
    for try await results in updateQueue {
        // Process results here.
    }
}
```

Query descriptors for series data, like [`HKQuantitySeriesSampleQueryDescriptor`](/documentation/HealthKit/HKQuantitySeriesSampleQueryDescriptor), use an asynchronous sequence to return the high-frequency samples from a condensed sample, for example accessing individual heart rate samples from data recorded during a workout. These sequences have a finite size. When your app iterates over the sequence’s contents, the iteration automatically terminates after you receive all the data.

Other query descriptors, like [`HKAnchoredObjectQueryDescriptor`](/documentation/HealthKit/HKAnchoredObjectQueryDescriptor), use this method to set up long-running queries that monitor the HealthKit store in the background. These queries continue to send updates using the asynchronous sequence. In these cases, code that iterates over the sequence continues until you cancel the sequence.

---

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)