有没有办法在团队中共享 Xcode 模板



在工作中,我们一直在朝着基于 VIPER 的架构发展,所以我编写了一个 Xcode 模板来创建和实例化所有必需的文件,它非常适合我们的需求。

我已经将其粘贴~/Library/Developer/Xcode/Templates,它工作并显示良好,但是我被要求研究是否可以在整个团队中同步它,而不必在有更改时通过电子邮件将其发送给每个人,或重新上传到 Confluence 并让每个人都重新下载并重新安装它。现在,我已经在网上查看了,但我看不到任何关于在团队成员之间同步它们的帮助,所以我只是想问你们是否知道一种方法?

谢谢一百万人

我的项目也有同样的事情,我所做的只是将模板文件添加到源代码管理上(到一个单独的文件夹中)并编写一个 shell 脚本来安装/卸载模板:

请注意,它使用符号链接,因此任何更新都将传播。

#!/usr/bin/env bash
set -eo pipefail
# Default the folder name to "Project Name".
folderName="Project name that will show under Xcode Menu"
scriptPath="$( cd "$(dirname "$0")" ; pwd -P )"
xcodeTemplateDirectory=~/Library/Developer/Xcode/Templates/File Templates/
linkName="$xcodeTemplateDirectory"/"$folderName"
if [ $1 == "install" ]; then
    # Create the install directory if it does not exist.
    if [ ! -d "$xcodeTemplateDirectory" ]; then
        mkdir -p "$xcodeTemplateDirectory"
    fi
    rm -rf "$linkName"
    ln -s "$scriptPath"/"$folderName" "$xcodeTemplateDirectory"
fi
if [ $1 == "uninstall" ]; then
    rm -rf "$linkName"
fi

最新更新