Adding a Search Field to Your Application

You can create a search field programatically, but the easiest way to add a search field to your application is to create it in a xib file in Xcode. Simply drag a search field from the Controls library and add it to a window.

In Xcode, you can use the Attributes Inspector to set search-field-specific attributes:

You can also set other attributes inherited from NSSearchField’s superclasses, such as:

Unless you’re using the Cocoa bindings Predicate binding, you need to set the target and action of the search field (for more details see “Implementing the Target”). You can also connect a search field to a menu template. The details of the menu’s contents are described in “Configuring a Search Menu.”