I get this strange warning from Xcode when I build the starter project.
warning build: Run script build phase ‘SwiftLint’ will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking “Based on dependency analysis” in the script phase.
It would be nice to “address this warning” but I cannot find where to do it. Any hints?
btw I upgraded to Xcode Version 14.0 on macOS 12.6.
We use SwiftLint to make the code style consistent.
Click the project name at the top of the Project navigator, then select your target.
Go to Build Phases, find the Run Script phase and click the disclosure arrow to expand it.
If you don’t want to use SwiftLint or don’t have in installed, click the trash icon at the top right of the phase to delete it.
If you do want to lint your code and want to stop this warning, uncheck the Based on dependency analysis button below the script.
I unchecked the button and the warning has gone away. It wasn’t a big deal at all it turns out.
I have used Lint-like products before with other languages and they can be useful for readability. I don’t have swiftlint installed. I looked around and found several different sites where a version could be downloaded. I hesitate when there are so many. Your script is:
PATH=/opt/homebrew/bin:$PATH
if [ -f ~/com.raywenderlich.swiftlint.yml ]; then
if which swiftlint >/dev/null; then
swiftlint --no-cache --config ~/com.raywenderlich.swiftlint.yml
fi
fi
I don’t have a /opt/homebrew directory. I have separately installed the Homebrew package in /usr/local but there is no swiftlint executable there. I don’t have any YAML files from raywenderlich either, so this script is never going to work for me.
This is driven by a new option in Xcode 14. The SwiftLint phase has been in all your RayWenderlich.com builds for a couple of years now.
To fix it, select the project (top level item) in the Project Navigator. Next, select Build Phases in the menu across the top. Twirl open the SwiftLint phase and UNCHECK ** “Based on dependency analysis”.
We’ll make sure this is fixed in all the book projects in a future update.