# Working around limitations in Swift Package Manager for binary distribution

**URL:** <https://forums.swift.org/t/working-around-limitations-in-swift-package-manager-for-binary-distribution/77187>\
**Category:** Package Manager\
**Tags:** binary-framework\
**Created:** [January 13, 2025, 11:16pm UTC](https://forums.swift.org/t/working-around-limitations-in-swift-package-manager-for-binary-distribution/77187 "2025-01-13T23:16:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonyarnold](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tonyarnold/32/30924_2.png) [@tonyarnold](https://forums.swift.org/u/tonyarnold)\
**Post date:** [January 13, 2025, 11:16pm UTC](https://forums.swift.org/t/working-around-limitations-in-swift-package-manager-for-binary-distribution/77187/1 "2025-01-13T23:16:59Z")

</div>

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](http://revealapp.com).

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?

---

<div class="post-metadata">

**Author:** ![grantjbutler](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/grantjbutler/32/11599_2.png) [@grantjbutler](https://forums.swift.org/u/grantjbutler)\
**Post date:** [January 14, 2025, 5:09pm UTC](https://forums.swift.org/t/working-around-limitations-in-swift-package-manager-for-binary-distribution/77187/2 "2025-01-14T17:09:11Z")

</div>

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](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0273-swiftpm-conditional-target-dependencies.md) proposed this functionally, it wasn't fully implemented due to [lack of support in the underlying build system](https://github.com/swiftlang/swift-package-manager/pull/2598#issuecomment-650881025). 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](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0450-swiftpm-package-traits.md) 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.

---

<div class="post-metadata">

**Author:** ![tonyarnold](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tonyarnold/32/30924_2.png) [@tonyarnold](https://forums.swift.org/u/tonyarnold)\
**Post date:** [January 20, 2025, 4:03am UTC](https://forums.swift.org/t/working-around-limitations-in-swift-package-manager-for-binary-distribution/77187/3 "2025-01-20T04:03:36Z")

</div>

It looks like I filed an issue around this back in 2022: [Support conditional dependencies based on the current build configuration · Issue #5645 · swiftlang/swift-package-manager · GitHub](https://github.com/swiftlang/swift-package-manager/issues/5645)

---

<div class="post-metadata">

**Author:** ![johnno1962](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/johnno1962/32/6805_2.png) [@johnno1962](https://forums.swift.org/u/johnno1962)\
**Post date:** [January 20, 2025, 2:21pm UTC](https://forums.swift.org/t/working-around-limitations-in-swift-package-manager-for-binary-distribution/77187/4 "2025-01-20T14:21:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tonyarnold](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tonyarnold/32/30924_2.png) [@tonyarnold](https://forums.swift.org/u/tonyarnold)\
**Post date:** [January 21, 2025, 1:40am UTC](https://forums.swift.org/t/working-around-limitations-in-swift-package-manager-for-binary-distribution/77187/5 "2025-01-21T01:40:23Z")

</div>

Sadly, `#if DEBUG` has no effect within the Package description.

---

<div class="post-metadata">

**Author:** ![johnno1962](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/johnno1962/32/6805_2.png) [@johnno1962](https://forums.swift.org/u/johnno1962)\
**Post date:** [January 21, 2025, 7:11am UTC](https://forums.swift.org/t/working-around-limitations-in-swift-package-manager-for-binary-distribution/77187/6 "2025-01-21T07:11:21Z")

</div>

FB9025127, August 2021
