Strip Binary Symbols (iOS)

Swift binaries include large amounts of symbols in a segment of the binary used by the dynamic linker. These are generally not needed in production builds. If you build your app with bitcode these symbols will automatically be stripped out. However, Xcode 14 deprecated bitcode by default and Apple will remove the ability to build with bitcode in a future Xcode release. Here's the command to strip symbols for a particular binary:

strip -rSTx AppBinary -o AppBinaryStripped

The T flag tells strip to remove Swift symbols, the other flags remove debugging and local symbols. Symbol stripping can be done automatically by adding a custom "Run Script" build phase at the very end of building, that would look something like:

set -e

# if [ "Release" = "${CONFIGURATION}" ]; then # Only do this for release builds
    # Path to the app directory
    # Strip main binary
    strip -rSTx "${APP_DIR_PATH}/${EXECUTABLE_NAME}"
    # Path to the Frameworks directory
    # Strip symbols from frameworks, if Frameworks/ exists at all
    # ... as long as the framework is NOT signed by Apple
    if [ -d "${APP_FRAMEWORKS_DIR}" ]
        find "${APP_FRAMEWORKS_DIR}" -type f -perm +111 -maxdepth 2 -mindepth 2 -exec bash -c 'codesign -v -R="anchor apple" "{}" &> /dev/null || (echo "{}" && strip -rSTx "{}")' \;
# fi