views:

3354

answers:

4

Why is Refactor... grayed out (disabled) in Xcode?

I'd like to rename a class.

+11  A: 

Select the class's symbol in its header file - i.e. the bit just after @interface. Then the refactoring stuff should be enabled.

Noah Witherspoon
My class's header file has only @interface, no @class. But selecting the symbol after @interface seems to work.
Elliot
@class if for forward declarations…s
Jonathan Sterling
This has been bothering me for quite some time also. Thanks!
Jonatan Hedborg
+6  A: 

If you are using Objective-C++ (i.e. mix Objective-C with C++ code) then refactoring is disabled in xcode since it does not support refactoring of C++ code.

Volker Voecking
Yes and it's really annoying!!!
sbwoodside
+3  A: 

Refactor might also be disabled if affected files (most likely the file with your class in it) are not saved.

klaaspieter
Saving a xib file in Interface Builder re-enabled Refactoring for me, when even relaunching Xcode wasn't helping, thanks!
Vincent Gable