---
title: limit
framework: healthkit
role: symbol
role_heading: Instance Property
path: healthkit/hkanchoredobjectquerydescriptor/limit
---

# limit

The maximum number of samples that the query returns.

## Declaration

```swift
var limit: Int?
```

## Discussion

Discussion If the limit is nil, the system returns all matching samples in the HealthKit store.

## See Also

### Accessing Query Properties

- [predicates](healthkit/hkanchoredobjectquerydescriptor/predicates.md)
- [anchor](healthkit/hkanchoredobjectquerydescriptor/anchor.md)
