---
title: HKSourceQuery
framework: healthkit
role: symbol
role_heading: Class
path: healthkit/hksourcequery
---

# HKSourceQuery

A query that returns a list of sources, such as apps and devices, that have saved matching queries to the HealthKit store.

## Declaration

```swift
class HKSourceQuery
```

## Overview

Overview Source queries return a list of sources that have saved samples matching the specified sample types. Sources can be apps or devices (like Apple Watch or Bluetooth heart-rate monitors). Source queries are immutable: Their properties are set when they are first created, and they can’t change.

## Topics

### Creating Source Queries

- [Executing Source Queries](healthkit/executing-source-queries.md)
- [init(sampleType:samplePredicate:completionHandler:)](healthkit/hksourcequery/init(sampletype:samplepredicate:completionhandler:).md)

## Relationships

### Inherits From

- [HKQuery](healthkit/hkquery.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Sources and devices

- [HKSourceQueryDescriptor](healthkit/hksourcequerydescriptor.md)
- [HKSourceRevision](healthkit/hksourcerevision.md)
- [HKSource](healthkit/hksource.md)
- [HKDevice](healthkit/hkdevice.md)
