When duplicating a target in Xcode, is there any way to set the name that the target will have before or as it is created? When duplicating a target in Xcode, is there any way to set the name that the target will have before or as it is created? xcode xcode

When duplicating a target in Xcode, is there any way to set the name that the target will have before or as it is created?


Unfortunately, I'm pretty darn sure there's not any current UI for this, although I strongly agree that it would be a huge improvement; I can't speak for everyone, but I pretty much never want a target named Foo copy. I would suggest filing a Radar.


You could, with some effort, use CMake for that. It's a build system generator.

It may be difficult at first to learn and setup the project, and some things are (currently) not easily possible for Xcode (like resource adding) but it would make creating new targets with a basic configuration very easy.

Basically, you write CMakeLists.txt files in your source tree to define your libraries and targets, then define the source files, etc., then generate the Xcode project each time.

Adding a new target would be very easy:

  1. ADD_EXECUTABLE( Target_Name Source_Files )
  2. SET_TARGET_PROPERTIES( Target_Name PROPERTIES COMPILE_DEFINITIONS Your_Additional_Defines )
  3. Rerun CMake. (Its not even required to close the Xcode project)

Disadvantages:

  • Takes time to setup.
  • Sometimes research is necessary to get some things to work
  • Some things are currently not well supported via CMake


In Xcode 6 (not sure about earlier versions) duplicating a target will still generate the " copy" appendage and rename all localized menus for example. But, it is reversible by updating the Product Name under Packaging in Build Settings / All. Info.plist will still have to be taken care of as well as Scheme naming though.