---
title: "init(block:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nspredicate/init(block:)"
---

# init(block:)

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

## Declaration

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

## Parameters

- `block`: The block is applied to the object to be evaluated. The block takes two arguments: 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

Return Value A new predicate by that evaluates objects using block.

## Discussion

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.

## See Also

### Creating a Predicate

- [init(format:argumentArray:)](foundation/nspredicate/init(format:argumentarray:).md)
- [init(format:arguments:)](foundation/nspredicate/init(format:arguments:).md)
- [init(format:_:)](foundation/nspredicate/init(format:_:).md)
- [init(_:)](foundation/nspredicate/init(_:).md)
- [withSubstitutionVariables(_:)](foundation/nspredicate/withsubstitutionvariables(_:).md)
- [init(value:)](foundation/nspredicate/init(value:).md)
- [init(fromMetadataQueryString:)](foundation/nspredicate/init(frommetadataquerystring:).md)
