One Logo Pool Ball
AppIntents · IOS API REFERENCE

EntityQuery

protocol · iOS 16.0+ · SDK 27.1

protocol EntityQuery : DynamicOptionsProvider, PersistentlyIdentifiable, Sendable

An interface for locating app entity instances by identifier. An entity query defines how Apple Intelligence, Siri, and the Shortcuts app retrieve instances of a specific ``AppEntity`` type, and implements the lookup logic. To let Siri and Shortcuts retrieve `AppEntity` instances, create a type that conforms to ``EntityQuery``. ### Resolve entities by identifier In some scenarios, Apple Intelligence already knows exactly which entity the person is referring to, and needs to retrieve the actual entity instance given its unique identifier. To support this retrieval method, implement ``entities(for:)``, which, given an array of ``AppEntity`` identifiers, returns corresponding entity instances. In your `entities(for:)` implementation, first look up whether the instance already exists in memory. If the instance doesn't exist, make asynchronous calls — for example, retrieving from disk or a backend service. If the entity for a provided identifier is no longer available, omit it from the returned array. ```swift struct MyPhotoQuery: EntityQuery { func entities(for identifiers: [UUID]) async throws -> [MyPhoto] { myPhotoStore.filter { identifiers.contains($0.id) } } } ```

Members (2)

method · iOS 16.0+

suggestedEntities

Swift declaration
func suggestedEntities() async throws -> Self.Result

Returns the initial results to display when the system presents options backed by this query.

method · iOS 16.0+

results

Swift declaration
func results() async throws -> Self.Result

Skipped declarations

2 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

EntityQuery.allowedExecutionTargets

Static protocol requirements cannot be called through an instance.

EntityQuery.displayRepresentations(for:)

The iOS SDK compiler rejected this binding: cannot access associated type 'Entity' from 'EntityQuery'; use a concrete type or generic parameter base instead

All AppIntents types →