Warnings as errors in sub packages


We're having some problems with using warnings-as-errors in new Xcode versions. I've searched online and no-one is talking about this issue so here goes...

Our project is split up into multiple sub packages and at the top we have an Xcode workspace which contains the iOS application Xcode project.

We use warnings-as-errors in ALL of our modules, in every sub package, via .unsafeFlags(["-warnings-as-errors"]) SwiftSetting defined on each module. Treat warnings as errors is also enabled in the app Xcode project.

Day to day workflow for engineers is to work directly inside a sub package rather than in the workspace, for obvious reasons. Sub packages themselves can depend on other, lower level, sub packages. So something like:

Core - no dependencies
Feature A - depends on Core sub package
App - depends on both Core and Feature A sub packages

Starting in Xcode 15.2, when working in Feature A we started seeing "ghost" errors produces by Xcode saying `Conflicting options '-warnings-as-errors' and '-suppress-warnings' (in target 'X' from project 'Core'). By ghost errors I mean they were reported as errors but did not produce a nonzero exit code, so the build passed. That changed in Xcode 15.3 where these now do fail the build.

Inspecting the Xcode build log the -suppress-warnings is indeed added automatically. Strangely this is NOT an issue when working in the main workspace - there Xcode does not add -suppress-warnings automatically - but only when working in a package directly in Xcode.

Is there a way to prevent Xcode from adding -suppress-warnings automatically when building local sub package modules? A bit surprised noone is having these issues, is using warnings-as-errors not a common practice?

Thanks for any help in advance


We have the exact same problem after updating to Xcode 15.3. Fixes or workarounds would be warmly welcomed! :smile:

1 Like

Just a short update - I submitted this problem to Apple Feedback Assistant, haven't heard back yet but will post here if/when I do.

1 Like

For me, in Xcode 15.3 the build fails in the main project as well unfortunately.
In other words, the error from a local Swift Package makes the whole build fail and therefore blocks me from updating to Xcode 15.3 :disappointed:

I was on Xcode 15.1 before and there it resulted in the "ghost errors" as well without failing the build.

Ghost errors are still a problem in Xcode 15.3, if by "ghost error" you mean previous errors that Xcode doesn't clear from the UI but which don't fail the build.

@Jon_Shier I'm referring to ghost errors in the way the author of this topic did in his initial post.