Chapter 8. Searching
WHAT'S IN THIS CHAPTER?
Searching and replacing text in a single file
Searching and replacing text across multiple files
Using advanced search patterns
Using search history to repeat searches and revisit results
Learning search shortcuts and tricks
A lot of development is spent just looking for things: finding all occurrences of a particular constant, looking for a message in a string, finding where a family of symbols is defined, and so on. Learning to use Xcode's find and replace features can save you a lot of tedious work.
Xcode provides five basic facilities for finding, and potentially replacing, text and code definitions in your project:
Single file search
Edit All in Scope
Taking the last two first, the Edit All in Scope feature was described in the "Editing Symbol Names" section of Chapter 7. Refactoring, which can change (aka find and replace) symbol names intelligently, is described in Chapter 10. All of the remaining tools are described in this chapter.
Single and multi-file search tools search the text files in your project for text patterns or regular expressions, and optionally replace them, either individually or en masse. You can also search your project's symbol definitions (Code Sense index) intelligently to locate the code that defines a symbol.
Xcode keeps a history of your searches and their results, making it easy to repeat a search or revisit the result of a former one. Finally, a lot of shortcuts ...