<!--
{
  "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",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "App Intents"
    ],
    "preciseIdentifier" : "s:10AppIntents19EntityQueryPropertyC"
  },
  "title" : "EntityQueryProperty"
}
-->

# EntityQueryProperty

An object that provides the supported comparators you use to describe the different ways users can query against a property
of an app entity.

```
final class EntityQueryProperty<Entity, Subject, Property, PropertyType, ComparatorMappingType> where Entity : AppEntity, Subject : AppEntity, Property : EntityProperty<PropertyType>, PropertyType : _IntentValue, PropertyType : Sendable
```

## Overview

Entity query properties are defined by by providing a `KeyPath` to an [`AppEntity`](/documentation/AppIntents/AppEntity) property in your data
model that this property applies to and then specify the set of supported [`EntityQueryComparator`](/documentation/AppIntents/EntityQueryComparator)s for
this property.

`EntityQueryProperty` allows you to define more than one [`EntityQueryComparator`](/documentation/AppIntents/EntityQueryComparator) with functionality
beyond strict equality. The set of comparators available depends on the underlying property type. For example, an
<doc://com.apple.documentation/documentation/Swift/Equatable>
property type will allow for [`EqualToComparator`](/documentation/AppIntents/EqualToComparator) and [`NotEqualToComparator`](/documentation/AppIntents/NotEqualToComparator) comparators while a
<doc://com.apple.documentation/documentation/Swift/Comparable> property type will add support for [`GreaterThanComparator`](/documentation/AppIntents/GreaterThanComparator),
[`GreaterThanOrEqualToComparator`](/documentation/AppIntents/GreaterThanOrEqualToComparator), [`LessThanComparator`](/documentation/AppIntents/LessThanComparator), and [`LessThanOrEqualToComparator`](/documentation/AppIntents/LessThanOrEqualToComparator)
comparators. See <doc://com.apple.documentation/documentation/Foundation/Comparator> for more details on available comparators.

An `EntityQueryProperty` doesn’t necessarily need to apply to a property of its parent Query
`Entity`.

Consider the scenario where you have an application containing Photo and Album entities, and you
want to support querying photos by the name of their containing album. Within a
[`EntityPropertyQuery`](/documentation/AppIntents/EntityPropertyQuery) in which `Entity` is Photo, you can define a `EntityQueryProperty` mapping to
a name property of the Album entity, as long as you supply a closure for `entityProvider` that
contains the logic to get from a Photo entity to an Album entity.

See [`init(_:entityProvider:comparators:)`](/documentation/AppIntents/EntityQueryProperty/init(_:entityProvider:comparators:)) for details.

## Topics

### Creating queryable properties

[`convenience init(KeyPath<Subject, Property>, comparators: () -> EntityQueryProperty<Entity, Subject, Property, PropertyType, ComparatorMappingType>.QueryComparators)`](/documentation/AppIntents/EntityQueryProperty/init(_:comparators:))

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

[`init(KeyPath<Subject, Property>, entityProvider: (Entity) -> Subject, comparators: () -> EntityQueryProperty<Entity, Subject, Property, PropertyType, ComparatorMappingType>.QueryComparators)`](/documentation/AppIntents/EntityQueryProperty/init(_:entityProvider:comparators:))

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

[`typealias QueryComparators`](/documentation/AppIntents/EntityQueryProperty/QueryComparators)

A type alias for the type that represents a collection of query comparators.

[`enum EntityQueryComparatorsBuilder`](/documentation/AppIntents/EntityQueryComparatorsBuilder)

A result builder that allows you to declaratively describe the comparators for a queryable property.

## Relationships

### Inherits From

[`EntityQueryPropertyDeclaration`](/documentation/AppIntents/EntityQueryPropertyDeclaration)

---

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)