<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/QueryPredicate/has(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation14QueryPredicateV3hasyACyAA6EntityCGqd__mAA9ComponentRd__lFZ"
  },
  "title" : "has(_:)"
}
-->

# has(_:)

Creates a new predicate that describes entities that have a specific
component.

```
static func has<T>(_ t: T.Type) -> QueryPredicate<Entity> where T : Component
```

## Parameters

`t`

The type of component.

## Return Value

A predicate that describes entities with a specified
component.

## Discussion

To create a `has` predicate, pass the component class’s `self` property.

```swift
let myPredicate = QueryPredicate.has(ModelComponent.self)
```

---

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)