<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Gesture/targetedToEntity(where:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI7GestureP012_RealityKit_aB0E16targetedToEntity5whereQr0D10Foundation14QueryPredicateVyAG0H0CG_tF"
  },
  "title" : "targetedToEntity(where:)"
}
-->

# targetedToEntity(where:)

Requires this gesture to target an entity that can be found in the results of the query.

```
@MainActor @preconcurrency func targetedToEntity(where query: QueryPredicate<Entity>) -> some Gesture<EntityTargetValue<Self.Value>>
```

## Parameters

`query`

A query to filter which entity the gesture targets.

## Return Value

A `RealityCoordinateSpaceConverting` value containing
the original gesture value along with the targeted entity.

---

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)