One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

EntityQuery

struct · iOS 15.0+ · SDK 27.1

struct EntityQuery

An object that retrieves entities from a scene. Use entity queries to iterate through all entities in a RealityKit scene that meet certain criteria. To specify which entities to retrieve, use a ``QueryPredicate``. To execute the query, pass it into the scene’s ``RealityKit/Scene/performQuery(_:)`` method and then iterate over the results. ```swift // Build a query to retrieve all anchor components. let query = EntityQuery(where: .has(AnchorComponent.self)) // Find and modify the scene's entities that have an anchor component. scene.performQuery(query).forEach { entity in // Make any needed changes to entities. } ```

Members (2)

init · iOS 15.0+

init

TypeScript
static initWhere(predicate: QueryPredicate<Entity>): EntityQuery
Swift declaration
init(where predicate: QueryPredicate<Entity>)

Creates a query that returns all entities in a scene that match specific criteria. - Parameters: - predicate: The criteria that specifies the entities to return.

init · iOS 15.0+

init

TypeScript
static init(): EntityQuery
Swift declaration
init()

Creates a query that returns all entities in a scene.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →