---
title: "init(type:subpredicates:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nscompoundpredicate/init(type:subpredicates:)"
---

# init(type:subpredicates:)

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

## Declaration

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

## Parameters

- `type`: The type of the new predicate.
- `subpredicates`: An array of NSPredicate objects.

## Return Value

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

## Discussion

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).

## See Also

### Creating Compound Predicates

- [init(andPredicateWithSubpredicates:)](foundation/nscompoundpredicate/init(andpredicatewithsubpredicates:).md)
- [init(notPredicateWithSubpredicate:)](foundation/nscompoundpredicate/init(notpredicatewithsubpredicate:).md)
- [init(orPredicateWithSubpredicates:)](foundation/nscompoundpredicate/init(orpredicatewithsubpredicates:).md)
- [init(coder:)](foundation/nscompoundpredicate/init(coder:).md)
