PDA

View Full Version : Renaming a Class.




larswik
Mar 3, 2012, 01:31 AM
HI, In a hurry the other day I was not paying attention when I created a new Class and it started out with a lower case instead of upper case letter. Is it as simple as just editing the name of the Class to correct this?

I ask because a while back I deleted a Class by mistake and even after reconstructing that header file it always gave me errors. So before I try to attempt to just rename this one I thought I would ask.

Thanks.



stirfie
Mar 3, 2012, 01:45 AM
You need to refactor the class.

Go the help file in xcode and look up refactor, there are a few options there, one of them is for renaming the class.

larswik
Mar 4, 2012, 01:44 AM
I am glad I asked.

Thanks!

admanimal
Mar 4, 2012, 01:53 AM
Generally speaking there is nothing wrong with just renaming the class as long as you make sure to change all instances of it. You'd probably want to rename the files, too. I assume Xcode's rename refactoring just automates this.