1

I created a class called Equation and then wanted to rename it to Problem. I changed the name in the interface (@interface Problem : NSObject) and the name in the implementation file (#import "Problem.h" and @implementation Problem). I also changed the actual file name. I'm getting this error: Class 'Problem' defined without specifying a base class and this warning: Cannot find interface declaration for 'Problem'. I ended up deleting and creating the class again, and it worked fine. Is there an easy way to rename files in Xcode?

Black Frog
  • 11,595
  • 1
  • 35
  • 66
stumped
  • 3,235
  • 7
  • 43
  • 76

2 Answers2

3

If you right-click the class name, you can choose refactor-rename. XCode isn't perfect at this, but it usually works.

enter image description here

Be careful with things your rename and invoke via reflection as they probably won't be picked up by XCode in the name change.

Kevin DiTraglia
  • 25,746
  • 19
  • 92
  • 138
0

you could just right click on the name of the class (i.e. Equation in your case) and click refactor->rename. The refactor utility automatically change class name, file name and imports.

Pablosproject
  • 1,374
  • 3
  • 13
  • 33