SwiftUI: Command SwiftCompile failed with a nonzero exit code

I have a SwiftUI app that I've been working on in XCode 16.1. The project builds and runs in the simulators, on my mac and on my iPhone/iPad without any issues. I'm also able to build my unit test project and run them without any errors. The project has zero warnings in it.

When I go to the Edit Schemes options and change the Run scheme to be a Release build with the Debug Executable unchecked I get a compiler error:

Command SwiftCompile failed with a nonzero exit code

I've attempted this Release Run with the following target devices in XCode:

  • My iPhone 15 Pro Max (iOS 18.2 Beta 3)
  • MacBook Air (M1) (15.2 Beta)
  • iPhone 16 Simulator (iOS 18.1)
  • Any iOS Simulator Device (arm64, x86_64)

All 3 of these target have the same issue. Normally I would just debug the error from the logs but when I look at the build output I can't see any information in the log to tell me what happened. It looks like the source files are sent into the SwiftCompiler and the compiler fails without bubbling up the issue.

I've provided the full error log export as a Gist HERE due to it's size. Is there anything in the log I'm missing? Is there a way for me to turn on more verbose logging during compilation of a Release Build?

I created a brand new Multiplatform App in XCode and I added all of my source files to it. No project configuration settings were changed. I could build it successfully with the debug configuration. I then changed it to the Release configuration and experienced the same error. I can create another fresh project and make the same release configuration with none of my source files in it and get a successful build. I

t seems there is something wrong with my source files and the release configuration but the compiler doesn't indicate what. I'm lost at this point as I can't figure out how to get a release build and can't seem to find any indication as to why.

SwiftUI: Command SwiftCompile failed with a nonzero exit code
 
 
Q