suggestedEntities
Swift declarationfunc suggestedEntities() async throws -> Self.ResultReturns the initial results to display when the system presents options backed by this query.
protocol · iOS 16.0+ · SDK 27.1
protocol EntityQuery : DynamicOptionsProvider, PersistentlyIdentifiable, SendableAn 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) } } } ```
func suggestedEntities() async throws -> Self.ResultReturns the initial results to display when the system presents options backed by this query.
func results() async throws -> Self.Result2 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