With the impending end of CocoaPods in sight, I'm once again assessing how SwiftPM can meet our needs to distribute the XCFramework SDK that we ship with Reveal.
Out of the box, SwiftPM isn't up to the task — we strongly recommend that consumers don't integrate our SDK into builds of their app destined distribution via TestFlight or the App Store — and there is no way to ask SwiftPM or Xcode to only integrate a SwiftPM binary target when the build's config is debug like we did with CocoaPods.
I can see that there might be a way to work around this for now with a little bit of scripting and some manual steps, but I'm keen to hear if anyone else has successfully tackled this problem yet?
I'm also interested in this for similar reasons. Our app codebase includes a number of different debug tools to use while working on the app. As we work to modularize our codebase, it'd be great to have these debug tools in their own targets that we can then conditionally add to our project based off of the build configuration. While SE-0273 proposed this functionally, it wasn't fully implemented due to lack of support in the underlying build system. It'd be great if we could get the second part of the proposal across the finish line, but I'm not sure how feasible that is/how involved the whole process would be to do so.
Package traits looked potentially promising as a way to do this for us, but it also seems to lack a way of conditionalizing things based off of build configurations. Plus it hasn't actually shipped yet so we don't know what the Xcode integration looks like. It's possible that it could conditionalize which traits are set based off of build configurations, but it's also possible it wouldn't, based off of what happened with SE-0273. I also don't think that'd work for you since it doesn't seem to do anything for binary artifacts, only for source code.
As a fellow developer of developer tooling I'd always thought #if DEBUG meaning something inside a Package.swift might have been a solution for this. Easy enough to implement for the command line but inside Xcode it means a complete re-resolution each time you switch from Debug to Release build though that might actually be a feature.