<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKSampleQuery/limit",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKSampleQuery(py)limit"
  },
  "title" : "limit"
}
-->

# limit

The maximum number of samples that this query returns.

```
var limit: Int { get }
```

## Discussion

This property’s value sets the maximum number of samples that the query returns upon completion.

If you are specifically interested in retrieving only new samples (samples added since the last query), consider using an [`HKAnchoredObjectQuery`](/documentation/HealthKit/HKAnchoredObjectQuery) query instead.

---

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)