<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.6.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSPredicate/init(block:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPredicate(cm)predicateWithBlock:"
  },
  "title" : "init(block:)"
}
-->

# init(block:)

Creates a predicate that evaluates using a specified block object and bindings dictionary.

```
init(block: @escaping (Any?, [String : Any]?) -> Bool)
```

## Parameters

`block`

The block is applied to the object to be evaluated.

    The block takes two arguments:

- evaluatedObject: The object to be evaluated.
- bindings: The substitution variables dictionary. The dictionary must contain key-value pairs for all variables in the receiver.

    The block returns     <doc://com.apple.documentation/documentation/Swift/true>     if the     `evaluatedObject`     evaluates to true, otherwise     <doc://com.apple.documentation/documentation/Swift/false>    .

## Return Value

A new predicate by that evaluates objects using `block`.

## Discussion

In macOS 10.6 and later, Core Data supports block-based predicates in the in-memory and atomic stores, but not in the SQLite-based store.

---

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)