Update: Although this post was originally written about Xcode 4 the procedure is the same in Xcode 5
I’ve always found it annoying that the Apple templates for Navigation-based Projects called the root view controller class RootViewController. If you create a really great view controller and then realize it would be useful in another project you have to rename the class and all the files. In XCode 3 this meant renaming the .m, .h and .xib files, using search and replace to rename the class interface and implementation sections and the using Interface Builder to make sure the MainWindow.xib and your newly renamed .xib knew about one and other.* The new refactoring functionality in XCode 4 make this much less painless.
To rename a class begin by switching to the symbol navigator view. You can do this by clicking the icon shown in Figure 1 or choosing View > Navigators > Symbol.
Select the class you want to rename.
Choose Edit > Refactor > Rename….
Enter the new name of the class (see Figure 2).
The preview action sheet, shown in Figure 3, allows you to view side by side all the proposed changes to your files.
Click Save and you are done!
The only gripe I have is that this process failed to rename the .xib file so I had to do that manually and edit MainWndow.xib’s view controller to point to newly renamed file. Even with this slight glitch, the overall process took less than a minute and is considerably less error-prone that the manual XCode 3 method.
* A couple of hours after publishing this article I finally found the refactor menu item in XCode 3. I will write a blog article about it soon.