在XCode中切换运行脚本构建阶段

Mik*_*ike 6 xcode ios run-script xcode6 ios8

我有一个运行脚本构建阶段,我已添加到XCode项目中.我希望能够在我希望它运行时切换此运行脚本,在我不运行时关闭.这在XCode中是否可行?如果是这样,它怎么办?

bal*_*630 2

我曾经exit在第一行编写来关闭脚本并#exit打开脚本,就像这样:

关闭脚本,例如 SwiftLint:

exit
if which swiftlint >/dev/null; then
  swiftlint
else
  echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
Run Code Online (Sandbox Code Playgroud)

打开:

#exit
if which swiftlint >/dev/null; then
  swiftlint
else
  echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
Run Code Online (Sandbox Code Playgroud)

不管 exit 是否被注释掉,你只需要修改 1 个字符即可。