Rob
Rob

Reputation: 4224

Xcode: Template doesn't show

I have tried to create an Xcode template, it's located at this path:

/Users/rob/Library/Developer/Xcode/Templates/TestTemplate.xctemplate

In this folder:

___FILEBASENAME___.swift

I checked the path in Xcode Preferences > Locations:

enter image description here

But when I try to create a new file in Xcode, this template doesn't appear. What am I doing wrong?

Thanks for your help.

Upvotes: 1

Views: 2231

Answers (1)

Swift Dev Journal
Swift Dev Journal

Reputation: 20088

Xcode has both project and file templates. You need to create a File Templates folder inside the Templates folder to store your file templates. You should also create a group folder inside the File Templates folder to store your file templates so there's a section for the templates in the New File Assistant.

/Users/rob/Library/Developer/Xcode/Templates/File Templates/My Templates/TestTemplate.xctemplate

Where My Templates is the name of the group holding the file template. You can name the group anything you want.

Upvotes: 5

Related Questions