AppCode 2019.2 Help


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

  1. 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.

  2. Choose Refactor | Rename from the main menu or from the context menu, or press ⇧F6.

  3. The subsequent behaviorfor Swift depends on the Enable in-place mode checkbox located on the Editor of the Preferences dialog (⌘,).

    • 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 suggestions
  4. Preview and apply changes.

Rename a file

  1. Select a desired file in the Project tool window.

  2. Choose Refactor | Rename on the main or context menu or press ⇧F6.

  3. 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.

    Rename a directory

  4. 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.

Last modified: 25 July 2019

See Also