martin's
martin's

Reputation: 3955

XCode file naming

OK, this is in the pet peeve department. Not terribly important but sometimes annoying.

I am creating a series of test projects to experiment with various ideas. The projects are named "Test 1" through whatever.

When the project is created by XCode I get file names like "Test_1AppDelegate.h" and "Test_1ViewController.h".

What I want is: "Test_1_AppDelegate.h" and "Test_1_ViewController.h", which is far more readable and "civilized", if you will.

Is there a way to make this happen?

What I've resorted to now is a really messy process:

  • I name the project with a trailing space: "Test 1 "
  • This gives me the file names I want within the project.
  • I then have to go and use Project>Rename to remove the trailing space from the project name
  • At this point, close the project and rename the directory to remove the trailing space.

    OK, it works, but it is convoluted and hopefully not necessary. This also produces a couple of "casualties" with weird naming that I simply have to live with:

    "Test_1__Prefix.pch" // Double underscores
    "Test_1_-Info.plist" // Underscore prior to hyphen

    Again, not a huge deal, but it'd sure be nice to clean-up the naming as a part of the automagic project creation process.

    Like many things XCode, it's a love-hate relationship.

    Thanks,

    -Martin

    Upvotes: 0

    Views: 140

  • Answers (1)

    ericg
    ericg

    Reputation: 8722

    While I haven't done it, you can define your own custom project template. I would start first by examining the supplied project templates at:

    (Xcode folder)/Library/Xcode/Project Templates/

    to see the overall structure. The most difficult part is finding documentation on this topic, because I could not find any documentation supplied by Apple. This likely means that it is subject to change at any time and the work you put into defining your own template may need to be tossed.

    I was able to find some instructions with a simple google search: Xcode custom project template

    For example:

    Upvotes: 2

    Related Questions