Build Phases
でNew Run Script Phase
を追加して以下のコードをコピーしてビルドするだけ
if [ ! -e .swiftformat ]; then
touch .swiftformat
fi
if [ "${CONFIGURATION}" = "Debug" ] && [ "${ENABLE_PREVIEWS}" = "NO" ]; then
if [ ! -e swiftformat ]; then
curl -OL https://github.com/nicklockwood/SwiftFormat/releases/download/0.52.2/swiftformat.zip
unzip swiftformat.zip
rm swiftformat.zip
fi
./swiftformat --cache ignore --swiftversion 5.8 .
else
echo "swiftformat in skipped"
fi
if [ ! -e .swiftlint.yml ]; then
touch .swiftlint.yml
fi
if [ "${CONFIGURATION}" = "Debug" ] && [ "${ENABLE_PREVIEWS}" = "NO" ]; then
if [ ! -e swiftlint ]; then
curl -OL https://github.com/realm/SwiftLint/releases/download/0.52.4/portable_swiftlint.zip
unzip portable_swiftlint.zip swiftlint
rm portable_swiftlint.zip
fi
./swiftlint --no-cache
else
echo "swiftlint in skipped"
fi
もし権限エラー発生時はBuild Settings
でENABLE_USER_SCRIPT_SANDBOXING
をNO
に設定
touch: .swiftformat: Operation not permitted