---
title: HKSourceQueryDescriptor
framework: healthkit
role: symbol
role_heading: Structure
path: healthkit/hksourcequerydescriptor
---

# HKSourceQueryDescriptor

A query interface that uses Swift concurrency to read the apps and devices that produced the matching samples.

## Declaration

```swift
struct HKSourceQueryDescriptor<Sample> where Sample : HKSample
```

## Mentioned in

Reading data from HealthKit

## Overview

Overview Use HKSourceQueryDescriptor to run a general query that returns a snapshot of all the apps and devices that have saved matching data to the HealthKit store. // Create the source descriptor. let sourceDescriptor = HKSourceQueryDescriptor(predicate: .workout())

// Read the source data from the HealthKit store. let sources = try await sourceDescriptor.result(for: store)

for source in sources {     // Process the sources here.     print(source) } When you call the descriptor’s result(for:) method, it creates and executes an HKSourceQuery in the background, passing the results as an array of HKSource instances.

## Topics

### Creating Source Query Descriptors

- [init(predicate:)](healthkit/hksourcequerydescriptor/init(predicate:).md)

### Running Queries

- [result(for:)](healthkit/hksourcequerydescriptor/result(for:).md)

### Accessing Query Properties

- [predicate](healthkit/hksourcequerydescriptor/predicate.md)

### Default Implementations

- [HKAsyncQuery Implementations](healthkit/hksourcequerydescriptor/hkasyncquery-implementations.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [Escapable](swift/escapable.md)
- [HKAsyncQuery](healthkit/hkasyncquery.md)

## See Also

### Sources and devices

- [HKSourceRevision](healthkit/hksourcerevision.md)
- [HKSource](healthkit/hksource.md)
- [HKDevice](healthkit/hkdevice.md)
- [HKSourceQuery](healthkit/hksourcequery.md)
