What is the bindings parameter for the block in predicateWithBlock: used for?

旧街凉风 提交于 2019-12-03 23:59:03

See the class documentation:

You can also create predicates that include variables, so that the predicate can be pre-defined before substituting concrete values at runtime. In Mac OS X v10.4, for predicates that use variables, evaluation is a two step process (see predicateWithSubstitutionVariables: and evaluateWithObject:). In Mac OS X v10.5 and later, you can use evaluateWithObject:substitutionVariables:, which combines these steps.

Then check out the predicate syntax docs.


If you were to subsequently invoke evaluateWithObject:substitutionVariables:, said dictionary would be passed to your block. This enables rather generic predicate creation where the resulting predicate can be passed around and a consistent substitution language can be used for evaluation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!