The safest way to rename files is to refactor the class name with the Xcode "Refactor" command. Using this command, make sure your code is also updated wherever a file or class is specified (including NIB).
Right-click the class name in the interface file ( .h ), select Refactor->Rename , and Xcode will guide you through the process, allowing you to view the changes before you commit them.
More details:
Right-click the class name (after @interface ) and select "Refactor-> Rename". For example, right-click on the ViewController in this code:
@interface ViewController : UIViewController

Enter a new name for the class:

Xcode will let you see the changes before committing.

You can also highlight the class name and use the Xcode Edit->Refactor menu, or even match it with a key combination if you want.
If you really want to rename the file without affecting any code, click on the name in the "Navigator" panel (left panel), wait a second and click again. The name will be highlighted and you can enter a new one. You can also delete from the Navigator, rename the file to Finder and re-add it to your project.
nevan king Jun 17 2018-10-17T00: 00Z
source share