Finding and Searching in Your Project

You’ll find that, as your classes get bigger, sometimes you’ll want to find a symbol or some other text in your project. Xcode provides a number of ways to do that.

Using the Find command to locate an item in a file

Need to track down a single symbol or all occurrences of a symbol in a file or class? You can easily locate what you’re looking for by choosing Edit⇒Find⇒Find or pressing maccmd+F, which opens a Find toolbar above the Editor pane to help you search the file in the editor.

For example, as shown in Figure 7-13, I entered viewDidLoad in the Find toolbar. Xcode found both instances of viewDidLoad in the Source editor and highlighted them. (Admittedly, the first highlight is a tad darker.)

Figure 7-13: You can use Find to locate something in a file.

9781118231333-fg0713.tif

9781118231333-ma025.tif You can jump from one instance to the next by pressing maccmd+G. Or you can use the Previous and Next buttons (left and right arrows) on the Find bar.

Click the Find pop-up menu in Find toolbar and choose Replace to do a file-level replace.

Click the magnifying glass in the Search field in the Find toolbar ...

Get iPad Application Development For Dummies, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.