<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSPredicate/init(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So11NSPredicateC10FoundationEyABSgAC9PredicateVyx_QPGcSo8NSObjectCRbzlufc"
  },
  "title" : "init(_:)"
}
-->

# init(_:)

Creates a predicate by converting an existing predicate.

```
convenience init?<Input>(_ predicate: Predicate<Input>) where Input : NSObject
```

## Parameters

`predicate`

The predicate to convert.

## Return Value

The converted predicate, or `nil` if conversion fails.

## Discussion

Only a subset of predicates that can be expressed by [`Predicate`](/documentation/Foundation/Predicate) are convertible to [`NSPredicate`](/documentation/Foundation/NSPredicate). Predicates that include operations like the following can’t be converted:

- Accessing key paths for properties that aren’t exposed to the Objective-C runtime.
- Capturing values of types that aren’t supported by `NSPredicate`, like custom Swift structures.
- Using some functions or operators, like performing collection operations on a nonstring value.

---

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)