Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

refactoring a whole class name in whole xcode project

I just changed my class name from Group.h to CVGroup.h and therefore everything is affected in my code. Is it possible to refactor the whole project so that Group is refactored into CVGroup?

like image 892
aherlambang Avatar asked Jul 26 '11 00:07

aherlambang


3 Answers

In short, there is functionality that is supposed to do just that, but it doesn't always catch all of the instances. You can select the class name in the header file and then do Edit > Refactor > Rename and that will try and catch all of the instances (this is in Xcode 4). The nice thing is that it will let you see the diff's of where it was changed.

I will say from experience that this method usually missed several instances of the name, so a manual follow-up is almost always required.

like image 122
dtuckernet Avatar answered Nov 15 '22 07:11

dtuckernet


Have you tried the Refactor command? In your Group.h file highlight the class name and choose Refactor->Rename from the Context Menu. This will rename the class everywhere it is used in your application.

like image 21
jaminguy Avatar answered Nov 15 '22 08:11

jaminguy


The same as described above will work in Xcode 6.2: Select the class name in the header file and then Edit > Refactor > Rename.

like image 28
Michelin Man Avatar answered Nov 15 '22 06:11

Michelin Man