<!--
{
  "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/EntityQueryProperty/init(_:entityProvider:comparators:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "App Intents"
    ],
    "preciseIdentifier" : "s:10AppIntents19EntityQueryPropertyC_14entityProvider11comparatorsACyxq_q0_q1_q2_Gs7KeyPathCyq_q0_G_q_xcSayAA03AnycD10ComparatorVyxq_q0_q1_q2_GGyXEtcfc"
  },
  "title" : "init(_:entityProvider:comparators:)"
}
-->

# init(_:entityProvider:comparators:)

Initializes a EntityQueryProperty that applies to entity property at the provided keyPath.

```
init(_ keyPath: KeyPath<Subject, Property>, entityProvider: @escaping (Entity) -> Subject, @EntityQueryComparatorsBuilder<Entity, Subject, Property, PropertyType, ComparatorMappingType> comparators: () -> EntityQueryProperty<Entity, Subject, Property, PropertyType, ComparatorMappingType>.QueryComparators)
```

## Parameters

`keyPath`

The keypath to the property that this EntityQueryProperty applies to. The target
property type determines which comparator modifiers will be available.

`entityProvider`

Closure which, given a `Entity` instance, returns the appropriate
`Subject` instance to apply `EntityQueryComparator`s to.

`comparators`

The set of `EntityQueryComparators` that this property supports being queried by.

---

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)