Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

Duplicating a target in Xcode is a great way to create multiple app or framework/library products that have somewhat different features using the same codebase as a result of conditional code controlled by environmental variables set within the target build settings or related schemes. First duplicate your known-working basic version, then set the environmental variables each target will use, then start splitting up your code behavior with inline preprocessor #ifdef statements.

However, any duplicated target will be named "Original Target Name copy". This can be renamed, but the info.plist will also have this name, it may also appear in a couple of essential build settings, and it can be a tedious and error-introducing process to remove all references to the non-informative "copy" version of the duplicated target name depending on how you do it. When I create iOS frameworks this seems to be especially prone to introducing issues.

My question is whether there is any technique for duplicating a target which allows you to specify the new target name at the time of duplication, so there is never a temporary wrong target name or any files being created which contain that temporary wrong name. Or, alternately, if there is some way to use the "refactor" functionality to fix this is an automated way.

If there is some kind of wrong assumption contained within the question that explains why this feature hasn't been included in Xcode, let me know. I'm using 4.3.

like image 800
Halle Avatar asked Apr 26 '12 14:04

Halle


1 Answers

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.

like image 139
ipmcc Avatar answered Sep 23 '22 18:09

ipmcc