Xcode 8.3: how to install multiple custom "Project Templates" in Xcode 8.3?

142 views Asked by At

I am trying to install two custom "project templates" in Xcode 8.3.3. To be more specific, I'm trying to install Cocos2D-obj templates for v2.1 and v2.2. (Cocos2D v3 or higher no longer use Xcode templates, but v2.x does.)

During the installation, each Cocos2D v2.1 and v2.2 creates its own Xcode template folders and those folders are simply copied into the Xcode's custom template folder:

~User/Library/Developer/Xcode/Templates/cocos2d v2.2 ~User/Library/Developer/Xcode/Templates/cocos2d v2.1

I was hoping to see that there are two separated templates (cocos2d v2.2 and cocos2d v2.1) available in the template menu when a new Xcode project is being created. However only one (either v2.2 or v2.1) appears in the template menu. (Interesting thing is that the last modified one appears.)

Basically it seems like Xcode doesn't allow to have more than one custom template in its menu. (However, "File template" menu shows both v2.2 and v2.1 "file template" correctly in Xcode, so only the project template doesn't.)

As far as I know this is something related to Xcode's custom template related behavior, but I cannot find any official document regarding custom template from Apple's document depository.

So the question is, how can I have two custom project templates (v2.1 & v2.2) appear in the template menu when new project is being created?

Any good answers or helpful comments are appreciated. Thanks in advance.

1

There are 1 answers

0
s4mt6 On BEST ANSWER

Finally I have figured it out how it goes. When it comes to "project template", Xcode looks like tracing the "identifier string" in the plist files of each templates. And when there are more than one template files exist under the same "identifier string", it chooses only one template randomly(?) among them and shows that in its template menu when an new project is being created. After manually modifying those identifier strings from the templates (in v2.1) not to have same ones against templates in other package (v2.2), Xcode brings them all in its template menu correctly. So I manually modified all cocos2d-v2.1 templates not to have same identifier strings against v2.2. Also, it is worth to be noted that some templates have "ancestors" in its fields such that those ancestors are also needed to be updated accordingly when the entire template package is modified for this reason. I wish I could see any official documents from Apple regarding how to handle Xcode's templates, (for the latest version of Xcode).