RandomDSdevel
RandomDSdevel

Reputation: 431

Creating Xcode Project Templates in Xcode 8.2.1

     How does one go about creating a project template in Xcode 8.2.1? I'm asking this because of how I would like to use such a project template as the basis for the many Xcode projects that I will most likely create in the process of learning how to program in C++ from Bjarne Stroustrup's Programming: Principles and Practices Using C++, Second Edition. Mr. Stroustrup provides his readers with several header files, which I have copied into a GitHub repository, on the book's rudimentary web site, and I would like to figure out how to link them into Xcode's build system.
     Someone created a makefile for use with the Darwin base of OS X, but I'd rather be able to use Xcode so that I can learn how to do so while I am learning C++ so that I know how to use it for later projects. I don't know whether I should use this makefile or not, but Apple does provide instructions on 'Building Makefile Projects with Xcode', so should I use those? I've also noticed that other people have similarly asked questions about how to create project templates for older versions of Xcode here, here, here, and here. Would any of the material from these Stack Overflow posts help my prospective answerer or answerers by providing them with some source material for their research?

Upvotes: 4

Views: 3773

Answers (3)

user4701250
user4701250

Reputation: 21

There seems to be an amazing lack of information on this topic. As far as I know templates have not changed materially since Xcode 4. Templates I made for it still work on Xcode 6.

Like one of the commenters above, I used this post to get started.

I am only developing for macOS (OS X), not iOS.

I also made some file templates, which are much easier; maybe try making one or two of them first. Macro names in file templates do need triple underscores at each end.

Upvotes: 2

GeneCode
GeneCode

Reputation: 7588

In XCode 7.3.1 (and maybe above versions too), you just need to go to Application folder, find XCode and right click on it and pick "Show Package Contents". Then, make your way to:

Contents/Developer/Library/XCode/Templates/..

In here you will find more folders which you mess with. Basically they are the items that appear when you goto XCode->File->New File... Becareful though, cause this is part of the XCode application. Not sure what will happen if you edit or add files wrongly.

ps. You also should quit XCode before opening the package contents.

Hope that helps.

Upvotes: 1

Ray
Ray

Reputation: 1

http://robnapier.net/project-templates This link helps me much,since the macros did not change. I want to custom a project template. But no automatic tools could be found,I make one my self.

first,drag a template to my desktop from Path below. Xcode ▸ Contents ▸ Developer ▸ Platforms ▸ iPhoneOS.platform ▸ Developer ▸ Library ▸ Xcode ▸ Templates ▸ Project Templates ( I use the empty template from the link: https://github.com/tobymao/EmptyApplication.xctemplate)

then,add your files to the *.xctemplate directory . And edit plist file. two items needs: Definitions which type should be Dictionary;Nodes which type is Array; In Definitions for each added file define a correspond Dictionary (name should be filename or filename had PROJECTNAMEASINDENTIFIER as prefix) ,which has key "Path" hold your files' path; In Nodes ,add all the items defined in Definitions. and, if you had your filename has projectname as prefix ,you should change content of your class files,change the classnames to macro FILEBASENAMEASIDENTIFIER at last , move your template directory back, and don't forget to change the identifier in plist.

Upvotes: -1

Related Questions