Skip to content

Instantly share code, notes, and snippets.

@dimohamdy
Last active July 23, 2023 13:15
Show Gist options
  • Save dimohamdy/208e7215b56a4f5b294be4473715adf2 to your computer and use it in GitHub Desktop.
Save dimohamdy/208e7215b56a4f5b294be4473715adf2 to your computer and use it in GitHub Desktop.
Script for Xcode build stage to list the unused code
#!/bin/bash
if ! command -v periphery &> /dev/null; then
echo "โŒ Periphery is not installed. Please install periphery before running this script."
else
cd .. # change the current directory
check_unused_codes_script="${SRCROOT}/../check-unused-codes.sh"
sorted_result=$("$check_unused_codes_script")
result_with_removed_code_line_number=$(echo "$sorted_result" | sed "s|:[0-9]+:[0-9]+:|:|")
IFS=$'\n' read -rd '' -a lines <<< "$result_with_removed_code_line_number"
for line in "${lines[@]}"; do
echo "${SRCROOT}/../$line"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment