I have a local Swift package used only within my app (not distributed publicly) for the sake of modularizing the codebase and sharing code between schemes. I want to create a compilation condition so I can produce a different binary to exclude code related to a particular feature while it's under development, so I added it to my Xcode project's build settings
I was hoping to have a single source-of-truth for this, but I know that SwiftPM uses configuration in the Package.swift file to manage this. I was hoping that the compilation condition would at least apply to the Package.swift, however, so I had written this code to vary the package's compilation conditions based off of it:
#if FEATURE
let compilationConditionSettings = [SwiftSetting.define("FEATURE")]
#else
let compilationConditionSettings = [SwiftSetting]()
#endif
Later on in the specific targets:
.target(
name: "Module",
path: "Sources/Library/Module",
swiftSettings: compilationConditionSettings
)
However, this doesn't seem to work. The code in Module gets compiled without the compilation flag, even though it's enabled in the project. Is it possible to do what I want to do?
