Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't Rename Files In Xcode 4 Anymore?

Tags:

xcode4

Seriously, in previous versions of XCode I could right-click a file or group in XCode and I would get the "rename" option. In XCode 4 I can't seem to rename my files in XCode directly anymore. What happened? Why would Apple remove such a feature? How can I rename my nibs, image resources, and others in XCode now?

like image 836
Andy Ibanez Avatar asked May 01 '11 20:05

Andy Ibanez


1 Answers

Note that if you're renaming a class, the best way I've found to do this is to open the class header, select the name of the class then control-click and choose Refactor / Rename. That way Xcode will rename the .h and .m files and replace instances of your class name (almost) everywhere it appears, including XIB files. Nifty!

Screenshot showing the Refactor / Rename context menu entry


Edit: in Xcode 4.2, watch out for this gotcha: "When initiating a refactoring rename operation from the declaration of a property, any Interface Builder files that refer to that property will not be updated correctly. Instead, perform the rename operation on a usage of the property, or an associated @synthesize statement."

like image 108
Simon Whitaker Avatar answered Oct 31 '22 18:10

Simon Whitaker