Toggle run script build phase in Xcode

1.4k views Asked by At

I have a run script build phase I have added to an Xcode project.

I want to be able to toggle this run script on when I want it to run and off when I don't.

Is this possible in Xcode and if so how can it be done?

1

There are 1 answers

0
balazs630 On

I used to write exit in the first line to toggle off the script and #exit to toggle on, just like this:

Turn off a script e.g. SwiftLint:

exit
if which swiftlint >/dev/null; then
  swiftlint
else
  echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

Turn on:

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

You just have to modify 1 character whether exit is commented out or not.