---
title: "init(sampleType:predicate:)"
framework: healthkit
role: symbol
role_heading: Initializer
path: "healthkit/hkquerydescriptor/init(sampletype:predicate:)"
---

# init(sampleType:predicate:)

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

## Declaration

```swift
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.
