更改 Xcode 11 模板文件 [英] Change Xcode 11 Template files

查看:32
本文介绍了更改 Xcode 11 模板文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想创建一个新文件时,如何更改 Xcode 模板文件?我在网上搜索,但更改这些的路径在 Xcode 11 中不正确

how can i change the Xcode Template files, when i want to create a new File? I searched online but the path to changes these wasn't correct with Xcode 11

我试过这些:

~/Library/Developer/Xcode/Templates
~/Library/Developer/Xcode/Templates/File Templates/Source
~/Library/Application Support/Developer/Shared/Xcode/File Templates/

但找不到模板文件.

推荐答案

添加/详述 Mark 的回答:

Adding/detailling on Mark's answer:

Xcode 路径适合我:

Xcode path is for me:

/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates

目标路径确实匹配(但模板文件夹不存在),所以我做到了:

Target path indeed matches (but Templates folder does not exist), so I did:

cp -fr /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates ~/Library/Developer/Xcode

现在,C++ 模板在哪里?隐藏在:

Now, where are the C++ templates? Hidden in:

/Users/michael/Library/Developer/Xcode/Templates/File Templates/MultiPlatform/Source/C++ File.xctemplate

在 C++ 项目模板文件中有什么作用?Apple 那边的人已经在这里睡了几十年了.

What has <cstdio> to do in C++ project template files?? Someone at Apple's side has been sleeping here for some decades.

无论如何,它有效,但我现在有重复的条目.我尝试删除原始文件夹,但它不起作用:sudo rm -rf/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates

Anyways, it works but I have duplicated entries now. I tried removing the original folder but it does not work: sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates

但无论如何.只需选择正确的文件即可.您还可以重命名C++ File.xctemplate".名称...文件"之前的任何内容似乎在 Xcode 中用作标签.

But anyways. Just picking the right files works. You can also rename the "C++ File.xctemplate" name... whatever is before "File" seems to work as a label in Xcode.

或者,您可以直接在 /Applications/Xcode.app 中更改模板,但在更新后会被覆盖.

Alternatively, you can just change the templates directly in /Applications/Xcode.app but then suffer from having them overwritten after update.

这篇关于更改 Xcode 11 模板文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆