IOS package dependency management tools

IOS package dependency management tool (part 1) : CocoaPods

IOS package dependency management tool (ii) : CocoaPods principle and knowledge

IOS package dependency management tool (3) : create your own Pod library

IOS Package dependency Management tool (4) : Swift Package Manager (SPM) Introduction

IOS Package dependency Management tool (5) : Swift Package Manager (SPM) Customization

IOS package dependency management tools (6) : CocoaPods VS SPM Summary

One, foreword

We’ve covered Pods and SPM, and how to make your own libraries, in a few articles, but only a comparative analysis.

Centralization vs. decentralization

You’ve all heard the term centralization, which means centralized management.

  • CocoaPods are centralized because all resource indexes are centralized in one repository (Master Repo represents Pods below);

  • SPM is decentralized. If you need any resources, you can download them from the corresponding repository.

3. Comparative analysis

\ CocoaPods SPM
Apply the language
O C , S w i f t \ color {green}} {OC, Swift

S w i f t \color{orange}{Swift}
Added :OC/C/CXX
Support library
Majority support \color{green}{most support}

Part of the support \color{orange}{partially supported}
Usage complexity
medium Medium \ color {orange} {}

simple Simple \ color {green} {}
Project invasion
serious \ color {red}} {serious

There is no No} \ color {green} {
The source code is visible
visible \ color {red} {is}

visible \ color {red} {is}
Compilation speed
slow Slow \ color {red} {}

slow Slow \ color {red} {}
Fix added: slower first time

However, as Apple continues to lean toward Swift, third-party Swift libraries will grow, and creating an SPM library is as simple as defining package. Swift; In the meantime, Apple is constantly improving SPM, and I’m sure it will soon be available for new projects.

2021.03.04 Edit again

First of all, thanks to the netizen @Di Ye pointed out, I will add to the above comparative analysis, so as not to mislead everyone!

SPM supports resource packaging starting with version 5.3

The improvements of 5.3 mainly include:

  1. Packages that support distribution can specify [different platform dependencies];
  2. Support for resource file packaging: images, files, storyboards, XiBs, and other files
  3. Binary (non-source level) dependencies are supported

SPM 5.0 also supports C and CXX: the PackageDescription API

public enum CLanguageStandard {
    case c89
    case c90
    case iso9899_1990
    case iso9899_199409
    case gnu89
    case gnu90
    case c99
    case iso9899_1999
    case gnu99
    case c11
    case iso9899_2011
    case gnu11
}

public enum CXXLanguageStandard {
    case cxx98 = "c++98"
    case cxx03 = "c++03"
    case gnucxx98 = "gnu++98"
    case gnucxx03 = "gnu++03"
    case cxx11 = "c++11"
    case gnucxx11 = "gnu++11"
    case cxx14 = "c++14"
    case gnucxx14 = "gnu++14"
    case cxx1z = "c++1z"
    case gnucxx1z = "gnu++1z"
}
Copy the code