Cocoapods庫的方式
- 本地庫
- 上傳到Cocoapods 遠程倉庫
- 私有庫
Cocoapods 上傳官方倉庫的引用版本問題
操作 | 說明 |
---|---|
pod ‘SwiftyJSON’ | 安裝pod最新版本 |
pod ‘SwiftyJSON’ , ‘4.0’ | 安裝指定版本 |
pod ‘SwiftyJSON’ , ‘> 4.0’ | 安裝版本高於4.0 |
pod ‘SwiftyJSON’ , ‘>=4.0’ | 安裝版本高於等於4.0 |
pod ‘SwiftyJSON’ , ‘< 4.0’ | 安裝版本小於4.0 |
pod ‘SwiftyJSON’ , ‘<=4.0’ | 安裝版本小於等於4.0 |
另外一種運算符
操作 | 說明 |
---|---|
pod ‘SwiftyJSON’ , ‘~> 0.1.2’ | 版本在[0.1.2 0.2)區間 |
pod ‘SwiftyJSON’ , ‘~> 0.1’ | 版本在[0.1 1.0)區間 |
pod ‘SwiftyJSON’ , ‘~> 5’ | 大於或者高於5 |
Cocoapods 私有庫引用方式
- 本地庫
操作 | 說明 |
---|---|
pod ‘Alamofire’, :path => ‘~/Documents/Alamofire’ | 指定庫路徑,找到podspec |
- 私有倉庫
操作 | 說明 |
---|---|
pod ‘Alamofire’, :git => ‘https://github.com/Alamofire/Alamofire.git’ | 指定遠程倉庫路徑,默認master 最新節點 |
pod ‘Alamofire’, :git => ‘https://github.com/Alamofire/Alamofire.git’, :branch => ‘dev’ | 指定分支,默認提交最新節點 |
pod ‘Alamofire’, :git => ‘https://github.com/Alamofire/Alamofire.git’, :tag => ‘3.1.1’ | 指定版本從tag 節點拉取 |
pod ‘Alamofire’, :git => ‘https://github.com/Alamofire/Alamofire.git’, :commit => ‘0f506b1c45’ | master 分支,從指定提交節點拉取 |