Carthage is a package management tool for iOS/Mac development ecosystem . Unlike the popular CocoaPods, it is a decentralized solution. I have known about it for a while, but I have never played with it. Today, I learned a lot from integrating Carthage and creating a Carthage-compatible Framework myself, so I decided to write a text to record it. First, let's briefly introduce CocoaPods, which is a popular iOS/Mac package management tool. The current latest version is 0.37.2, which already supports iOS Frameworks. It manages a total of 10,822 libraries (and growing), allowing developers to easily integrate a third-party library. After using it for a while, I think CocoaPods has the following advantages:
However, as a solution with a central repository, CocoaPods also has obvious shortcomings:
You already know one advantage of Carthage. Yes, if you use Carthage, all third-party library dependencies do not need to be recompiled unless they need to be updated. This greatly speeds up the time for normal compilation and archive. Each archive and clean compilation can save more than dozens of seconds, which is still very considerable. For this reason alone, Carthage is worth using. So, what are the advantages of Carthage? As mentioned earlier, it is decentralized and has no central server, which means that every time you configure and update the environment, you will only update the specific library, and there will be no process of obtaining the index of the *** library from the central server, which saves a lot of time. "Okay, okay, if there is a third advantage, I will be convinced and start using Carthage!" The third advantage is: seamless integration with CocoaPods! "What? Using two package management tools for one project, won't that cause problems?" After my own experiments, I have successfully transformed my "Singularity" project into a configuration where Carthage + CocoaPods jointly manage dependencies. There is no conflict at all. Because Carthage is not a fully automatic and full-featured third-party library configuration tool like CocoaPods, its design philosophy is to complete the trivial parts and give the main control to the developer. It will not generate a Workspace like CocoaPods, which means I can freely control how to put the Framework into my Project/Workspace, whether it is Required or Optional. When I found that Carthage is so flexible, I did not hesitate to give a small number of other Frameworks to Carthage for management under the current configuration of CocoaPods managing the main Framework. They coexist very harmoniously. In fact, there is another main reason why I use Carthage, which is that it is so simple to create a third-party library and make it available to Carthage. I don't need to use a complex structure + declaration file model like CocoaPods. I only need to create a Project/Framework and set the Framework Scheme to Shared. In this way, the directory of my third-party library is very clean, without any files related to Carthage, but Carthage can find and use it. I like such a simple and pure technical solution. The above is the fourth advantage of Carthage: projects with standard structures are naturally Carthage libraries. After listing these four major Carthage advantages, let's talk about its shortcomings:
I don’t know when these four disadvantages will be solved (I think the fourth one cannot be solved due to project configuration), but considering the four advantages mentioned above, the use of Carthage still saves me time and effort. |
<<: Ronglian Cloud Communications Tips: How to Lower the Threshold for Acquiring Real Users
>>: How to make the next match-3 game?
[[428363]] Good news! WeChat and Alipay announced...
As a marketing planner, planning promotion activi...
The RX 9070 series finally won back a game for AM...
With the increasing intelligence of search delive...
With the successful entry of the Tianhe core modu...
gossip Kissing is an ancient and popular way to e...
Facing the turmoil in Ideal Auto, Chairman Li Xia...
Is global warming making fish stupid ? If you can...
Zhou Yanjie lady body 10-session quick slimming y...
When you enter the live broadcast room of Li Jiaq...
The aromatherapists at Xi'an Tea Club have be...
As the weather turns cold, the cold winter is com...
Apple today released the third beta of iOS 8.4 to...
From the first well-known "Legend of the Sho...
In 2010, the tablet computer was born under the c...