<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppIntents",
  "identifier" : "/documentation/AppIntents/EntityPropertyQuery/entities(matching:mode:sortedBy:limit:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "App Intents"
    ],
    "preciseIdentifier" : "s:10AppIntents19EntityPropertyQueryP8entities8matching4mode8sortedBy5limit6ResultQzSay21ComparatorMappingTypeQzG_AA0ceM4ModeOSayAA0cE4SortVy0C0QzGGSiSgtYaKF"
  },
  "title" : "entities(matching:mode:sortedBy:limit:)"
}
-->

# entities(matching:mode:sortedBy:limit:)

Retrieves instances matching the supplied comparators.

```
func entities(matching comparators: [Self.ComparatorMappingType], mode: Self.ComparatorMode, sortedBy: [EntityQuerySort<Self.Entity>], limit: Int?) async throws -> Self.Result
```

## Parameters

`comparators`

Array containing mapped values for comparators that entities need to match

`mode`

Whether entity instances should match any or all comparators

`sortedBy`

Array describing the query’s sorting order

`limit`

Optional limit on the number of entity instances to return

---

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)