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?
Today I accidentally found my school photos. The ...
A good fission method can be reused. The number o...
At a press conference held by the State Council I...
There are three things in life that are intolerab...
After finally getting through the summer mosquito...
The pricing of e-commerce products is very critic...
On the morning of June 4, D2809 train was hit by ...
We spend money on promotion for the sake of resul...
Ding Tianyu - Technical Practice Guide, Make Mone...
520 has just passed and the Dragon Boat Festival ...
This article aims to systematically sort out and ...
Since WeChat became a work app, the number of fri...
Welcome to Science Popularization China’s special...
Recently, the COVID-19 epidemic has reached a cli...
I have heard many of my friends and colleagues ta...