关于cocoapods的发展以及安装在此不做赘述,网上一搜一大把。
使用:
http://guides.cocoapods.org/using/using-cocoapods.html
关于cocoapods的使用还是非常简单的。首先通过Xcode新建一个项目
图1然后在项目所在目录创建一个Podfile配置文件
图2配置文件主要配置需要引用的第三方开源库,配置文件编辑完成后,接下来就执行安装命令。打开终端进入项目所在目录,然后执行命令pod install
图3然后就会在项目目录下生成workspace工程文件,打开该工程文件就可以进行正常开发了。
图4创建自定义库
https://guides.cocoapods.org/making/index.html
首先通过pod lib create [your lib name] 命令创建一个framework
图5上述命令执行过程中会提示你输入对应的配置项,即回答相应问题
图5回答完毕之后,由于选用了demo app,所以在完成创建后Xcode会自动打开
图6Deploying your Library
So you've got your library ready to go. First you should check if the Podspec lints correctly, as you can't deploy with errors. This can be done with two methods, pod lib lint and pod spec lint. The difference between them is that pod lib lint does not access the network, whereas pod spec lint checks the external repo and associated tag.
编辑完podspec文件后,需要验证一下这个文件是否可用,如果有任何WARNING或者ERROR都是不可以的,它就不能被添加到Spec Repo中,不过xcode的WARNING是可以存在的,验证需要执行一下命令
图7https://guides.cocoapods.org/making/private-cocoapods
If you're deploying to a private Specs repo, you will need to have already added that repo. See the guides on Private Specs Repos to set that up. If you are deploying to an existing Private Repo, use this command to deploy:
讲MyLib库源码上传到github上
图8Add your Private Repo to your CocoaPods installation
图9
添加成功后,在“~/.cocoapods/repos/”目录下就会多出一个MyLib
图10Add your Podspec to your repo
网友评论