QueryPredicateGroup
public class QueryPredicateGroup : QueryPredicate, Encodable, @unchecked Sendable
extension QueryPredicateGroup: Equatable
Note
@unchecked Sendable, and not final, so that anyone who subclassed this keeps compiling.
The conformance is a genuine assertion, not a checked fact. and(_:) and or(_:) mutate
predicates in place and return self when the group type already matches, so two tasks
composing onto the same group race on an array — and predicates is public internal(set), so
external code reads it directly and a lock here would not cover those reads without turning it into
a computed property.
What makes this safe in practice is usage, not structure: a predicate is built up on one task and then handed to a query. Sharing a part-built group across tasks is unsupported, and nothing in the type enforces that. The exposure predates this annotation, which only stops the compiler asking.
-
Declaration
Swift
public internal(set) var type: QueryPredicateGroupType { get } -
Declaration
Swift
public internal(set) var predicates: [QueryPredicate] { get } -
Declaration
Swift
public init( type: QueryPredicateGroupType = .and, predicates: [QueryPredicate] = [] ) -
Declaration
Swift
public func and(_ predicate: QueryPredicate) -> QueryPredicateGroup -
Declaration
Swift
public func or(_ predicate: QueryPredicate) -> QueryPredicateGroup -
Declaration
Swift
public static func && (lhs: QueryPredicateGroup, rhs: QueryPredicate) -> QueryPredicateGroup -
Declaration
Swift
public static func || (lhs: QueryPredicateGroup, rhs: QueryPredicate) -> QueryPredicateGroup -
Declaration
Swift
public prefix static func ! (rhs: QueryPredicateGroup) -> QueryPredicateGroup -
Declaration
Swift
public func evaluate(target: Model) -> Bool
-
Declaration
Swift
public func encode(to encoder: Encoder) throws -
Declaration
Swift
public static func == (lhs: QueryPredicateGroup, rhs: QueryPredicateGroup) -> Bool
View on GitHub