AppCode 2022.2 Help

Copy and Move Refactorings

Copy

The Copy refactoring lets you create a copy of a file or directory in a different or the same directory.

  1. Select a file/directory in the Project tool window.

  2. Select Refactor | Copy from the main or context menu or press F5.

  3. In the Copy window, specify the name and location for your copy and click OK.

Move

The Move refactoring lets you move declarations and class members to another file/class and files/directories to another directory.

Move a file/directory

  1. Select a file/directory in the Project tool window.

  2. Select Refactor | Move from the main or context menu or press F6.

  3. In the Move dialog, specify a directory where the selected file will be moved to:

    Move dialog

    To have references to the selected file or folder updated according to the refactoring result, select the Search for references checkbox.

    Select Open moved members in editor if you want AppCode to open the files that have been moved.

    Click OK.

Move a declaration/member (Objective-C)

  1. Place the caret at the class, protocol, or member you want to move.

  2. Select Refactor | Move from the main or context menu or press F6.

  3. In the invoked dialog, select declarations/members you want to move and specify a new class name:

    Move Declaration dialog

    The members that will be affected by this refactoring are highlighted in red.

    Click Move. If necessary, click Preview to preview the potential changes.

  4. If you are moving a method that uses some members of the current class, you will get a notification that these members will be inaccessible in the moved code.

    If a method that you are moving is used by some members of the current class, you will be warned that the moved code will be inaccessible from these members.

    Conflicts during moving members

    Click Continue to perform the refactoring ignoring the warnings or Show Conflicts in View to open the conflicts in a dedicated view and fix them.

  5. When you are moving private members, AppCode will suggest to escalate their visibility level:

    Escalate visibility

    Click Yes if you want to accept the suggested changes or No if you want to edit the code later.

Last modified: 21 July 2022