PBXProj Release Debug Optimization

ID

swift.pbxproj_release_debug_optimization

Severity

low

Remediation Complexity

trivial

Remediation Risk

low

Remediation Effort

low

Resource

Efficiency

Language

Swift

Tags

build-config, efficiency

Description

Reports an Xcode Release configuration that ships with debug-grade optimisation settings — SWIFT_OPTIMIZATION_LEVEL = "-Onone" for Swift sources or GCC_OPTIMIZATION_LEVEL = 0 for Objective-C / C / C++ sources mixed into the same target.

// project.pbxproj
... /* Release */ = {
    buildSettings = {
        SWIFT_OPTIMIZATION_LEVEL = "-Onone";  // FLAW
        GCC_OPTIMIZATION_LEVEL = 0;           // FLAW
        SWIFT_OPTIMIZATION_LEVEL = "-O";      // OK
        GCC_OPTIMIZATION_LEVEL = s;           // OK (Apple's Release default)
    };
    name = Release;
};

Rationale

An un-optimised Release binary is slower to start, slower to run, and ships with the symbol tables and reflection metadata that a Release build normally strips. That regresses both performance and the reverse-engineering posture of the app. Distribution-target builds should always be -O (Swift) and -Os / -O3 (clang).

Every Release-named configuration in the file is inspected. The check accepts every non-debug Apple-canonical value as OK.

Remediation

Set SWIFT_OPTIMIZATION_LEVEL = "-O" (or -Osize if binary size matters more than CPU) for Release. For mixed-language targets, set GCC_OPTIMIZATION_LEVEL = s (Apple’s Release default).