Chapter 27. Search your LioNs
This chapter covers
- Adding search functionality
- Closures
- Cleaning up the code
Can you believe how far you’ve come in this book? You’re almost finished with the LioN app. It would be really nice if you allowed your users to search for the LioNs they’ve added—otherwise they’ll have to scroll through everything. Let’s see how to add that feature!
The first thing you need to do is add the search bar to the LioN scene. Search the Object Library for search, and two different objects will be returned. The first is Search Bar, which is just the visual component, and the second is Search Bar and Search Display Controller. You want the second component, because you can use the controller to capture and manage users’ searches. Grab the Search Bar and Search Display Controller, and drop it at the very top of the table view on the MainViewController scene, above the words Prototype Cells. It should automatically take up the entire scene horizontally, as shown in figure 27.1.