Find and replace in project
You can search for a text string within a project, use different scopes to narrow your search process, exclude certain items from your search, find usages and occurrences.
Find the search string in a project
From the main menu, select
⌃ ⇧ F.In the search field, type your search string. Alternatively, in the editor, highlight the string you want to find and press ⌃ ⇧ F. AppCode places the highlighted string into the search field.
To see a list of your previous searches, press ⌥ ↓.
If you need, specify the additional options.
AppCode lists the search strings and the files that contain them. If the search string is found several times on the same line of code, AppCode merges the results in one line.
To do a multi-line search, click the icon to enter a new line, and press ⌃ ⌥ ↓/⌃ ⌥ ↑ to browse through occurrences.
Check the results in the preview area of the dialog where you can replace the search string or select another string, press ⌃ ⇧ F again and start a new search.
To see the list of occurrences in a separate tool window, click Open in Find Window. Use this window and its options to group the results, preview them, and work with them further.
If you want to see each new search result in a separate tab in the Find tool window, click on the bottom of the Find in Files dialog and select the Open Results in New Tab checkbox.
Replace the search string in a project
Press ⌃ ⇧ R to open the Replace in Path dialog.
In the top field, enter your search string. In the bottom field, enter your replacement string.
For example, if you want to replace a variable name with a new name for a large project, use Replace in Path instead of Rename refactoring since your variable can appear in config files as well.
Click one of the available Replace commands.
Narrow your search
You can use different options in the Find in Files dialog to adjust your search process.
Select options such as Words () or Match case () to find the exact word in a project or match the letter case.
With selected, AppCode automatically escapes special regex symbols with backslash
\
when you search for a text string by selecting it in the editor and clicking ⌃ F.For more details on regex, refer to the search with regex documentation.
Click the icon to filter your search. For example, you can filter the search to omit comments or search only in comments instead.
Select one of the displayed options such as Module or Directory to limit your search.
Moreover, you can select the Scope option that offers you a list of predefined scopes for your search. For example, you can limit your search only to the open files in your project.
If you work without tabs, the scope Recently Viewed Files or Recently Changed Files option might become quite useful. You can also create your own custom scope, click the Browse icon () to open the Scopes dialog.
Search in the specific file types
Use the File Mask option to narrow your search to a specific file type. You can select the existing file type from the list, add a new file type, or add an additional file mask syntax to search for file types with certain patterns.
In the Find in Files dialog, select the File Mask checkbox and from the list of file types, select the one you need.
AppCode limits its search to the specified type.
If you don't find the file type you need in the list, enter your file type in the File Mask field.
For example, use the following syntax to search only in swift files: *.swift.
Besides
*
, other wildcards are supported. If necessary, specify several file types using commas as separators.