Using Carthage and CocoaPods in the same project

前端 未结 2 2063
你的背包
你的背包 2021-02-06 23:46

I\'m currently looking at a library which only supports Carthage as a package manager. The project I\'m looking to integrate it with already has some CocoaPods dependencies. Has

相关标签:
2条回答
  • 2021-02-07 00:10

    It is a good practice to use a single Dependency manager to have the best experience in version handling. You can ask a framework's developer to support it. There are a lot of edge cases but CocoaPods and Carthage do not conflict between each others that is why it is possible to use both of them at the same time

    [CocoaPods vs Carthage]

    0 讨论(0)
  • 2021-02-07 00:17

    The main issue you will run into is that CocoaPods and Carthage are not aware of each other. This means that if a dependency managed by CocoaPods and a dependency by Carthage share a common dependency, conflicts may arise.

    Carthage requires that you manually add frameworks to a project which means that you can probably get away with not linking any shared dependency and relying on the framework added by CocoaPods, but you won't get dependency version resolution across the two dependency managers and it won't be clear how it all works.

    With that said, there aren't any inherent reasons why you can't use both, and if the library you want to include has few or no dependencies, it's probably still preferable to use Carthage rather than including the library as a submodule or even copying the source in.

    My recommendation, if possible, is to include your other dependencies via Carthage, or to create a podspec for the library so that you can use Carthage or CocoaPods exclusively.

    0 讨论(0)
提交回复
热议问题