CocoaPods依赖库版本控制 - ShenYj/ShenYj.github.io GitHub Wiki
-
默认最简单的导入方式
pod 'Moya'
-
锁定版本
- 使用逻辑运算符
-
> 0.1
Any version higher than 0.1 -
>= 0.1
Version 0.1 and any higher version -
< 0.1
Any version lower than 0.1 -
<= 0.1
Version 0.1 and any lower version
-
- 除了逻辑运算符之外,
CocoaPods
还具有乐观运算符〜>
-
~> 0.1.2
Version 0.1.2 and the versions up to 0.2, not including 0.2 and higher -
~> 0.1
Version 0.1 and the versions up to 1.0, not including 1.0 and higher -
~> 0
Version 0 and the versions up to 1.0, not including 1.0 and higher
-
pod 'Moya', '~> 14.0.0'
- 使用逻辑运算符
-
锁定源
pod 'Moya', :git => 'https://github.com/Moya/Moya.git'
-
指定分支
pod 'Moya', :git => 'https://github.com/Moya/Moya.git', :branch => 'main'
-
指定
tag
pod 'Moya', :git => 'https://github.com/Moya/Moya.git', :tag => '14.0.0'
-
指定
commit
pod 'Moya', :git => 'https://github.com/Moya/Moya.git', :commit => '0f506b1c45'
-
使用本地资源
pod 'Alamofire', :path => '~/Documents/Alamofire'
-
组合
subspec
-
使用
:subspecs
pod 'Componentization', :subspecs => ['Core', 'Course', 'IAP'], :git => 'https://github.com/ShenYj/Componentization.git', :tag => '0.1.0'
-
单独导入
pod 'Componentization/Course', :git => 'https://github.com/ShenYj/Componentization.git', :tag => '0.1.0' pod 'Componentization/IAP', :git => 'https://github.com/ShenYj/Componentization.git', :tag => '0.1.0'
示例中的类库是一个私有库, 并没有
pod trunk push
到CocoaPods
远程仓库, 如果是开源库就更简单了 -