Surface build errors from Swift Package in Xcode project using it

Our iOS app is an xcworkspace that contains the xcproj of the app itself, and local SPM packages that the app depends on. This allows us to edit/search the entire codebase without caring if it's in a package or in the project - which is great.

The problem is that if the build failed due to a compile error in one of the packages, Xcode does not surface it in the Issue Navigator - instead, we only get "build failed", and need to poke in the build log (in Report Navigator) to see the error.

Is this something SPM can surface better to integrate with Xcode, or is it something folks from Xcode should look into?

Apologies if this is a known issue or was posted before - I tried to search and couldn't find any reference...

1 Like

Do you have a concrete example of the error that isn't being surfaced?

In my experience (in the exact same setup), the vast majority of build failures do get surfaced into Xcode's UI, such as invalid syntax or other illegal source code - but deeper level issues such as segfaults don't.

I also notice a better-than-average reporting when I switch my active scheme to the product of the Swift Package, rather than having my app's scheme being active.

invalid syntax and illegal code are also not surfaced - as simple as forgetting a , when calling a func with multiple arguments.
Indeed if the active sheme is the package - all errors are surfaced as expected. The thing is - we are working on the app project and the packages code all at the same time - I might edit a file without even noticing it's from one of our internal packages... I was expecting to be able to build the app as usual, and have errors surfacing from either compilation error in the project or the internal packages

1 Like