Xcode 4: how to customize File Templates and Project Templates?

前端 未结 2 556
粉色の甜心
粉色の甜心 2021-02-06 16:54

In Xcode 3, we worked out (by trial and error) that we could COPY the system templates to a new location (three possible locations, because Apple kept changing it), and customiz

相关标签:
2条回答
  • 2021-02-06 17:33

    This is only a partial answer to the question, but for anyone else struggling (like me) to work out the "correct" way, here's a workaround that partially works.

    Today, with Xcode 4.5.0, the following works:

    Customize file/project templates:

    1. Un-hide your Library folder (google if you don't know how, or else do this from Terminal)
    2. Create a folder: ~/Library/Developer/Xcode/Templates (the parent folder should already exist - Xcode4 auto-creates it)
    3. Find your copy of Xcode 4, and right click "Show Package Contents"
    4. Navigate in there until you find the "Templates" sub folder
      1. There are two folders, one for Mac, the other for iPhone
      2. Mac location: [Xcode4.app]/Contents/Developer/Library/Xcode/Templates
      3. iPhone location: [Xcode4.app]/Contents/Developer/Platforms/iPhoneOS.Platform/Developer/Library/Xcode/Templates
    5. Copy/paste the contents into the "Templates" folder you created
    6. CRITICAL: RENAME EVERY SUB-FOLDER OF "File Templates" OR ELSE APPLE WILL IGNORE/REMOVE YOUR TEMPLATES

    NB: in step 2 above, you can also ALLEGEDLY create that folder at:

    ~/Library/Application Support/Shared/Xcode/Templates

    ...but that never works for me, and the parent folder doesn't exist with new installs of Xcode 4.5, so I suspect Apple is phasing this out? (since they refuse to document it, I'm just guessing)

    0 讨论(0)
  • 2021-02-06 17:36

    It seems project templates can be in ~/Library/Developer/Xcode/Templates/Application/Project Templates.

    source: https://github.com/AFNetworking/Xcode-Project-Templates

    0 讨论(0)
提交回复
热议问题