Friday, July 20, 2012

Duplicate Projects xCode 4.3.3

I work with multiple projects in the same workspace. Each project uses the same library code, adding a few tweaks + resources (large pdf files) and metadata.

To create a new project, my practice has been to duplicate an existing project and then pull it into the workspace, This process isn't completely trivial, so I thought I post it.

Here's the recipe:

  • Copy the project folder in finder and rename
  • Add to workspace using these directions (right click, add file, pick .xcodeproj file)
  • Rename the project as shown below

     

     

     
rename project
 
  • If your appDelegate has the project name in it (per convention), it is necessary to not only use the refactoring tool to rename it, but also search for appDelegate & rename it in all files that reference it via a string (main.m is the usage I have in my project)

 

#import <UIKit/UIKit.h>

 

 

 

int main(int argc, char *argv[])

 

{

 

NSAutoreleasePool *pool = [NSAutoreleasePool new];

 

int retVal = UIApplicationMain(argc, argv, nil, @"detroit_gary_and_some_chicagoAppDelegate");

 

[pool release];

 

return retVal;

 

}

 

 
  • Change the prefix header
 
prefixHeader

schemeName

 

 

Not the easiest process, but at least it lends itself to a straightforward recipe.

 

It follows that Best Practice is to minimize the number of "project specific" names that you use in the project, minimizing the number of changes. This recipe only covers the case in which you change the project name, project folder and appDelegate.

 

 

No comments: