---
title: "init(predicate:limit:resultsHandler:)"
framework: healthkit
role: symbol
role_heading: Initializer
path: "healthkit/hkuserannotatedmedicationquery/init(predicate:limit:resultshandler:)"
---

# init(predicate:limit:resultsHandler:)

## Declaration

```swift
init(predicate: NSPredicate?, limit: Int, resultsHandler: @escaping (HKUserAnnotatedMedicationQuery, HKUserAnnotatedMedication?, Bool, (any Error)?) -> Void)
```

## Parameters

- `predicate`: The predicate which user annotated medications should match.
- `limit`: The maximum number of user annotated medications to return. Pass HKObjectQueryNoLimit for no limit.
- `resultsHandler`: The block to invoke with results to deliver to the client. The results handler will be called with done = YES when there are no more user annotated medications to enumerate.

## Discussion

Discussion Returns a query that will retrieve HKUserAnnotatedMedications matching the given predicate and limit.
