在 Xcode 中更改模板 [英] Change templates in Xcode

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

问题描述

在创建新的 Cocoa 类时,我将如何更改由 Xcode 创建的初始模板.

How would I change the initial templates created by Xcode when creating a new Cocoa Class.

我指的是在使用 Xcode 的新类向导时创建的注释和类名.

I am referring to the comments and class name created when using Xcode's new class wizard.

推荐答案

您不会更改现有模板.换句话说,不要修改/Developer 层次结构下的任何内容(或安装开发者工具的任何地方).

You wouldn't change the existing templates. In other words, don't modify anything under the /Developer hierarchy (or wherever you installed your developer tools).

相反,克隆您想要自定义变体的模板.然后更改他们的姓名和其中的信息.最后,将它们放在您帐户的 Library/Application Support 文件夹中的适当位置,特别是:

Instead, clone the templates you want to have customized variants of. Then change their names and the information in them. Finally, put them in the appropriate location in your account's Library/Application Support folder, specifically:

  • 文件模板:~/Library/Application Support/Developer/Shared/Xcode/File Templates/
  • 目标模板:~/Library/Application Support/Developer/Shared/Xcode/Target Templates/
  • 项目模板:~/Library/Application Support/Developer/Shared/Xcode/Project Templates/

这样,当您安装新的开发人员工具时,它们就不会被覆盖,而且您可以根据自己的喜好调整它们.

That way they won't be overwritten when you install new developer tools, and you can tweak them to your heart's content.

更新对于较新版本的 Xcode,更新后的路径将是:~/Library/Developer/Xcode/Templates/File Templates/Source

Update For newer versions of Xcode the updated path will be: ~/Library/Developer/Xcode/Templates/File Templates/Source

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

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