has(_:)
Creates a new predicate that describes entities that have a specific component.
Declaration
static func has<T>(_ t: T.Type) -> QueryPredicate<Entity> where T : ComponentParameters
- 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.
let myPredicate = QueryPredicate.has(ModelComponent.self)