安装参考:
http://www.jianshu.com/p/7cb597bf5f12
http://www.jianshu.com/p/7c49d81cbb8e
安装cocopods 21-5-31更新
git clone https://gitee.com/mirrors/CocoaPods-Specs.git ~/.cocoapods/repos/trunk
安装 brew:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
输入数字1 ,选择中科大下载源;后续输入系统密码;直至安装完成;
使用:
1、cd 项目中
2、touch Podfile //创建文件
3、open -e Podfile //打开文件
4、输入要的库:
#source 'https://github.com/CocoaPods/Specs.git'
source 'https://gitee.com/mirrors/CocoaPods-Specs.git'
platform :ios, ‘9.0’
use_frameworks!
target '工程的名字' do
pod 'SnapKit'
pod 'Kingfisher'
pod 'SVProgressHUD'
pod 'FDFullscreenPopGesture', '~> 1.1'
pod 'Alamofire','~> 3.4'
pod 'SwiftyJSON'
end
SnapKit swift约束库
Kingfisher 图片缓存库 用法 :testImag.kf_setImageWithURL(NSURL(string: "http://your_image_url.png")!, placeholderImage: UIImage(named: "mrt"))
FDFullscreenPopGesture 全屏侧滑返回上级页面
5、pod install //安装
6、 pod update 或者pod install --verbose --no-repo-update //更新 pod update 有可能被墙 /pod install --verbose --no-repo-update更新可能更不到最新库 还是需要使用pod update
7、pod search xxx // xxx代表项目名 搜索项目名 搜索完成按Q退出页面
8、pod repo update //出现搜索库不是最新库时 更新本地pod仓库命令
高级用法可参考链接
http://www.open-open.com/lib/view/open1442462680602.html
//注意 swift 使用cocoapods 需要 import 三方库名 例:import AFNetworking