[TARGETS]>[Build Phases]>[New Run Script Phase]を追加し、スクリプトに以下をコピペする。
# Type a script or drag a script file from your workspace to insert its path.
TARGET_DIR="$SRCROOT/YourAppName"
if xcrun --find swift-format >/dev/null; then
xcrun swift-format format --in-place --recursive "$TARGET_DIR"
xcrun swift-format lint --recursive "$TARGET_DIR"
else
echo "warning: Not Found swift-format."
fi
するとビルド時にフォーマットの実行や静的解析を行ってくれる。
コメント