<!--
{
  "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/init(type:subpredicates:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCompoundPredicate(im)initWithType:subpredicates:"
  },
  "title" : "init(type:subpredicates:)"
}
-->

# init(type:subpredicates:)

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

```
init(type: NSCompoundPredicate.LogicalType, subpredicates: [NSPredicate])
```

## Parameters

`type`

The type of the new predicate.

`subpredicates`

An array of `NSPredicate` objects.

## Return Value

The receiver initialized with its type set to type and subpredicates array to `subpredicates`.

## Discussion

For applications linked on macOS 10.5 or later, the `subpredicates` array is copied. For applications linked on OS X v10.4, the `subpredicates` array is retained (for binary compatibility).

---

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)