<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSCompoundPredicate",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCompoundPredicate"
  },
  "title" : "NSCompoundPredicate"
}
-->

# NSCompoundPredicate

A specialized predicate that evaluates logical combinations of other predicates.

```
class NSCompoundPredicate
```

## Overview

Use [`NSCompoundPredicate`](/documentation/Foundation/NSCompoundPredicate) to create an `AND` or `OR` compound predicate of one or more other predicates, or the `NOT` of a single predicate. For the logical `AND` and `OR` operations:

- An `AND` predicate with no subpredicates evaluates to <doc://com.apple.documentation/documentation/Swift/true>.
- An `OR` predicate with no subpredicates evaluates to <doc://com.apple.documentation/documentation/Swift/false>.
- A compound predicate with one or more subpredicates evaluates to the truth of its subpredicates.

## Topics

### Creating Compound Predicates

[`init(andPredicateWithSubpredicates:)`](/documentation/Foundation/NSCompoundPredicate/init(andPredicateWithSubpredicates:))

Returns a new predicate that you form using an AND operation on the predicates in a specified array.

[`init(notPredicateWithSubpredicate:)`](/documentation/Foundation/NSCompoundPredicate/init(notPredicateWithSubpredicate:))

Returns a new predicate that you form using a NOT operation on a specified predicate.

[`init(orPredicateWithSubpredicates:)`](/documentation/Foundation/NSCompoundPredicate/init(orPredicateWithSubpredicates:))

Returns a new predicate that you form using an OR operation on the predicates in a specified array.

[`init(type:subpredicates:)`](/documentation/Foundation/NSCompoundPredicate/init(type:subpredicates:))

Returns the receiver that a specified type initializes using predicates from a specified array.

[`init(coder:)`](/documentation/Foundation/NSCompoundPredicate/init(coder:))

Creates a predicate by decoding from the coder you specify.

### Getting Information About a Compound Predicate

[`compoundPredicateType`](/documentation/Foundation/NSCompoundPredicate/compoundPredicateType)

The predicate type for the receiver.

[`subpredicates`](/documentation/Foundation/NSCompoundPredicate/subpredicates)

The receiver’s subpredicates.

[`NSCompoundPredicate.LogicalType`](/documentation/Foundation/NSCompoundPredicate/LogicalType)

Constants that describe the possible types of a compound predicate.



---

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)