NSCompound is a subclass of
NSPredicate used to represent logical “gate” operations (AND/OR/NOT) and comparison operations.
- iOS 3.0+
- macOS 10.4+
- tvOS 9.0+
- watchOS 2.0+
Comparison operations are based on two expressions, as represented by instances of the
NSExpression class. Expressions are created for constant values, key paths, and so on.
In macOS 10.5 and later and in iOS, you can use
NSCompound to create an AND or OR compound predicate (but not a NOT compound predicate) using an array with 0, 1, or more elements:
An AND predicate with no subpredicates evaluates to TRUE.
An OR predicate with no subpredicates evaluates to FALSE.
A compound predicate with one or more subpredicates evaluates to the truth of its subpredicates.