Switching SPM products
arielelkin opened this issue · comments
I have a Swift package with two library products:
let package = Package(
name: "IRIS",
platforms: [.macOS(.v10_10)],
products: [
.library(
name: "MySDK-release",
targets: ["sdk-release"]
),
.library(
name: "MySDK-debug",
targets: ["sdk-debug"]
)
],
targets: [
.binaryTarget(
name: "sdk-release",
url: "https://api.github.com/bar.zip",
checksum: "..."
),
.binaryTarget(
name: "sdk-debug",
url: "https://api.github.com/foo.zip",
checksum: "..."
)
]
)
I need to link against MySDK-debug
in the debug version of my app, and against MySDK-release
in the release version of my app. SPM doesn't support this, so I'm trying to find a way to do it with XcodeProj (on CI I'd run a script which uses XcodeProj to switch the product). I unfortunately can't add both products to the xcode project as they have the same symbol names, and that produces "Multiple commands produce foo.h" errors. Is there a way to do this?
Hey @arielelkin,
Unfortunately XcodeProj
is not a tool to workaround limitations of the Swift Package Manager. If you want to do something that Swift Package Manager support, I'd recommend starting a discussion in the community forum. Alternatively, you might consider:
- Doing this setup with CocoaPods, Carthage, or an Xcode project and distributing your frameworks as xcframeworks.
- Using Tuist to model the setup.