<!--
{
  "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/init(sampleType:predicate:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKQueryDescriptor(im)initWithSampleType:predicate:"
  },
  "title" : "init(sampleType:predicate:)"
}
-->

# init(sampleType:predicate:)

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

```
init(sampleType: HKSampleType, predicate: NSPredicate?)
```

## Parameters

`sampleType`

The data type of samples that match this descriptor. For more information, see <doc://com.apple.healthkit/documentation/HealthKit/data-types>.

`predicate`

The predicate used to filter samples that match this descriptor. If the predicate is `nil`, the descriptor matches all samples of the specified data type.

---

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)