Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 14: Missing Template Folder: Create My Own? [duplicate]

When browsing ~/Library/Developer/Xcode/ to create my own custom template, it seems I am missing the Templates folder.

enter image description here

From what I've researched (like here), I assume a Template folder should already be present. I searched SO (for example) and (here) but cannot find any recent Xcode 14 related posts that explains 1) why it hasn't been already created and 2) if I should create my own instead.

What do I do when the Template folder is missing? Do create my own, or has it moved somewhere else?

like image 293
Pedro Cerrano Avatar asked Oct 17 '25 05:10

Pedro Cerrano


1 Answers

The short answer is: yes, I created my own Template folder, and it worked. Here's what I did...

Within ~/Library/Developer/Xcode/, I added Templates/File Templates/ and then I created a new folder to house my custom templates.

To build my own templates easily, I started with the source files in Xcode:

  1. I navigated to Xcode in the /Applications folder.
  2. Then right-clicked on the app and selected "Show Package Contents"
  3. Followed this path: Contents/Developer/Library/Xcode/Templates/File Templates
  4. Found the folder package I wanted (which was MultiPlatform/User Interface and copied the entire folder (SwiftUI View.xctemplate).
  5. Pasted the folder and it's files to the file path above in the User Library
  6. And made my edits to the Swift file!

Simple. See here:

enter image description here

I hope this can be helpful to someone and save time.

like image 167
Pedro Cerrano Avatar answered Oct 19 '25 12:10

Pedro Cerrano