阅读前篇:
本文基于已安装cocoapods并且替换源以后的小伙伴阅读,如未正确安装环境,请移步百度。且本文多参照这位小伙伴的组件化经验。
Cocoapods注册Trunk

老哥解释的很清楚,这里不用做多的解释。相信照着输入没有任何问题。
开源的pod
这里以github为例:
Step 1:新建repository

Step 2:完成仓库创建

Step 3:克隆到本地.
git clone *********************.git并且cd到对应目录下。
Step 4:创建.podspec文件
pod spec create 'name' 注:name请尽量与repository名称相同.
Step 5:修改.podspec文件内容



Step 6:保存并提交到github
在对应本地仓库里面创建Sources,并加入编写好的.h/.m文件。然后push到github上面。命令如下:

至此开源的pod创建成功
验证并发布pod
Step 1:切换到含有.podspec文件的目录下。执行:
pod spec lint 验证.podspec文件正确性
错误 1:xcrun: error: unable to find utility "simctl", not a developer tool or in PATH ) during validation。
解决办法如图:

注:必须验证成功后才发布。
验证成功截图:

Step 2:发布到cocoapods。执行:
pod trunk push 'name'.podspec
发布成功截图

Step 3:更新repo。执行:
pod repo update
更新成功后就能搜索到我们上传的pod了。
网友评论