<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKQueryDescriptor",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKQueryDescriptor"
  },
  "title" : "HKQueryDescriptor"
}
-->

# HKQueryDescriptor

A descriptor that specifies a set of samples based on the data type and a predicate.

```
class HKQueryDescriptor
```

## Overview

Use descriptors to create queries that return multiple data types. You can use descriptors when creating [`HKSampleQuery`](/documentation/HealthKit/HKSampleQuery), [`HKAnchoredObjectQuery`](/documentation/HealthKit/HKAnchoredObjectQuery), or [`HKObserverQuery`](/documentation/HealthKit/HKObserverQuery) instances.

## Topics

### Creating Query Descriptors

[`-  initWithSampleType:predicate:`](/documentation/HealthKit/HKQueryDescriptor/init(sampleType:predicate:))

Creates a new descriptor for the data type and predicate you provided.

### Accessing Descriptor Data

[`predicate`](/documentation/HealthKit/HKQueryDescriptor/predicate)

The predicate that filters samples matching this descriptor.

[`sampleType`](/documentation/HealthKit/HKQueryDescriptor/sampleType)

The data type of samples that match this descriptor.

## Relationships

### Conforms To

[`NSCopying`](/documentation/Foundation/NSCopying)

[`Sendable`](/documentation/Swift/Sendable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)