On page 50 we are told bq. [T]he NSSearchField interface element works off the principle of an NSPredicate […] using the Controller Key, Model Key Path and Value Transformer to bind it to our data. For example, if we wanted to ﬁlter on the name of recipes, we would bind this NSSearchField to our Recipe NSArrayController using the Controller Key of Arranged Objects and a Model Key Path of name.
I must be doing something wrong as this binding crashed the application. Digging further I tried the very handy tip of option - dragging an entity from Xcode onto an IB window, this pops up a ‘New Core Data Entity Interface’, where I had it add a search field, the field works as expected.
The binding for this search field is to the Recipe NSArrayController, but with a Controller Key of filterPredicate, no Model Key Path and a Predicate Format of
(name contains[c] $value), the parenthesis seem optional from my limited testing. Adding “name” to the Model Key Path breaks the predicate.
Thanks for reading!