#! /bin/sh # Check if the folder name is exactly "LoopFollow" FOLDER_NAME=$(basename "${SRCROOT}") if [ "${FOLDER_NAME}" != "LoopFollow" ]; then echo "Skipping swiftformat: This script only runs in the LoopFollow directory, not in '${FOLDER_NAME}'" exit 0 fi function assertEnvironment { if [ -z "$1" ]; then echo $2 exit 127 fi } assertEnvironment "${SRCROOT}" "Please set SRCROOT to project root folder" # Formatting is a developer convenience and must not prevent the app from # building when SwiftFormat has not been downloaded yet. Set # RUN_SWIFTFORMAT=1 explicitly when formatting is desired. if [ "${RUN_SWIFTFORMAT:-0}" != "1" ]; then echo "Skipping swiftformat (set RUN_SWIFTFORMAT=1 to enable it)" exit 0 fi unset SDKROOT swift run -c release --package-path BuildTools swiftformat "${SRCROOT}" \ --header "LoopFollow\n{file}" \ --exclude Pods,Generated,R.generated.swift,fastlane/swift,Dependencies,dexcom-share-client-swift