Xcode 4: Changing a Project’s Class Prefix

September 13th, 2012

Filed under: Xcode | Be the first to comment!

When you create a Cocoa or iOS application project, the New Project Assistant has a Class Prefix text field that lets you assign a prefix to class files you create. An example of a prefix is the NS prefix in Cocoa classes. But there are situations where you may need to change the prefix. You make a mistake entering the prefix, or you don’t create a prefix when creating the project, but decide later you want one. How do you change the prefix after creating the project?

You can change the class prefix by selecting the project from the project navigator and opening the file inspector.

ClassPrefix

I know the Class Prefix field exists in Xcode 4.4. I’m not sure if it exists in Xcode 4.2 and 4.3. The Class Prefix applies only to Objective-C classes. If you enter a class prefix and add a C++ class to the project, Xcode ignores the class prefix you entered.

Facebooktwittergoogle_plusredditmail

Tags:


Leave a Reply

Your email address will not be published. Required fields are marked *