Rename refactoring allows you to rename symbols and files globally with all the references to them in the code corrected automatically.
Renaming local variables or private methods can be done easily inline since only the limited scope is affected. Renaming classes or public methods could potentially impact a lot of files. In this case, we suggest that you preview potential changes before you refactor.
Rename a symbol
Select the item to be renamed.
To select a symbol in the editor, place the caret at the name of the symbol to be renamed.
To select a symbol in the Structure view, click the desired symbol in the Structure tool window ⌘7.
Choosefrom the main menu or from the context menu or press ⇧F6.
The subsequent behavior for Swift depends on the Enable in-place mode checkbox located in .
If this checkbox is selected, you can type a new name in the highlighted line in the editor. However, if you press ⇧F6 once more, AppCode will display the Rename dialog with more options.
If this checkbox is not selected, the Rename dialog opens immediately.
For Objective-C, the suggested name appears right below the symbol. You can either accept the suggestion or type a new name.
Rename a file
Select a desired file in the Project tool window.
Chooseon the main or context menu or press ⇧F6.
In the Rename dialog that opens, specify the new filename. Select Search in comments and strings checkbox to let AppCode apply changes to comments and strings.
Press Preview to observe possible changes in Find Tool Window. Press Refactor to proceed.
AppCode finds all the occurrences of the filename and changes them respectively.