使用:
$ pod COMMAND
CocoaPods 是 Cocoa library 的包管理器.
命令:
+ cache Manipulate the CocoaPods cache
+ init Generate a Podfile for the current directory.
+ install Install project dependencies to Podfile.lock versions
+ ipc Inter-process communication
+ lib Develop pods
+ list List pods
+ outdated Show outdated project dependencies
+ plugins Show available CocoaPods plugins
+ repo Manage spec-repositories
+ search Search for pods.
+ setup Setup the CocoaPods environment
+ spec Manage pod specs
+ trunk Interact with the CocoaPods API (e.g. publishing new specs)
+ try Try a Pod!
+ update Update outdated project dependencies and create new Podfile.lock
选项(可选命令):
--silent Show nothing
--version Show the version of the tool
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command
cat Podfile
source ‘https://github.com/CocoaPods/Specs.git’
platform:ios,’8.0’
use_frameworks!
忽略所有pods中的警告
ignore all warnings from all pods
inhibit_all_warnings!
def pods
#Swift
pod 'Alamofire'
pod 'Kingfisher'
pod 'ObjectMapper', '~> 1.0'
pod 'SwiftyJSON'
pod 'Dollar'
pod 'Cent'
pod 'KeychainAccess', '~> 2.3.4'
pod 'UIColor_Hex_Swift', '~> 2.0'
pod 'RxSwift', '~> 2.2'
pod 'RxCocoa', '~> 2.2'
pod 'RxBlocking', '~> 2.2'
pod 'XCGLogger'
pod 'Swift_cURLCommand'
pod 'SnapKit'
pod 'BSImagePicker', '~> 2.2'
#Objective-C
pod 'YYText'
pod 'SVProgressHUD', '~> 2.0-beta8'
pod 'INTULocationManager'
end
target 'TSWeChat' do
pods
end
cat Podfile
platform:ios,’8.3’
pod 'AFNetworking', '~> 3.0.0-beta.3'
pod 'SDWebImage', '~> 3.7.3'
pod 'SVProgressHUD', '~> 2.0-beta8'
pod 'MJExtension', '~> 3.0.7'
pod 'UMengSocial', '~> 4.3'
use_frameworks!
pod 'ReactiveCocoa', '~> 4.0.4-alpha-4’
pod 'MJRefresh', '~> 3.1.0'
pod 'DACircularProgress', '~> 2.3.1'
pod 'NJKWebViewProgress', '~> 0.2.3'
Cocoapods的Podfile常见语法总结
语法名称 | 语法说明 |
---|---|
source ‘URL’ | 指定镜像仓库的源 |
platform : ios, ‘6.0’ | 指定所支持系统和最低版本 |
inhibit_all_warnings! | 屏蔽所有warning |
workspace ‘项目空间名’ | 指定项目空间名 |
xcodeproj ‘工程文件名’ | 指定xcodeproj工程文件名 |
下面都是引入库的语句:
语法名称 | 语法说明 |
---|---|
pod ‘库名’, | 引入库,什么版本都可以(一般就是最新版本了) |
pod ‘库名’, ‘版本’ | 引入指定版本的库,下面的运算符可以指定版本的范围: |
> < >= <= | 不解释 |
~ > | 从指定版本到倒数第二位版本号升1为止,比如 ‘~> 1.2.1’是指 1.2.1 <= 版本 < 1.3.0 |
pod ‘库名’, :podspec => ‘podspec文件路径’ | 指定导入库的pod spec文件路径 |
pod ‘库名’, :git => ‘源码git地址’ | 指定导入库的源码git地址 |
pod ‘库名’, :tag => ‘tag名’ | 指定导入库的Tag分支 |