Search code examples
ioscocoapodsrx-swiftswift-package-managercarthage

Resolving overlapping dependencies (let's say RxSwift)


I have:

  • App depends on Framework A
  • Framework A depends on RxSwift v1.0
  • App depends on RxSwift v2.0

Is it possible to resolve this using CocoaPods, Carthage, SwiftPM? How?

Or I should align these versions of RxSwift?

Related questions:


Solution

  • In the section titled Compatibility Version Numbers at Runtime within https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/VersionInformation.html the context & meaning is fairly clear that the Xcode linker links against only one version (and that it must be the older version if the framework is dynamically linked). I.e., all of the determiners are singular: no linking 2 or more versions into the same app. So it seems that you have exactly 2 choices:

    • upgrade Framework A to utilize RxSwift 2.0
    • forego using RxSwift 1.0 in your app so as to use RxSwift 1.0 in your app (throughout your app, both Framework A and your app-domain)

    The desired choice of linking in both an RxSwift 1.0 identifier and an RxSwift 2.0 identifier for the same identifier is not possible with the Xcode linker, the desired choice (linking in 2 different versions of RxSwift into the same app executable) is actually a nonexistent choice—hence not an option after all.