1、创建自己的库
2、git clone https://xxxxxx.git 克隆到本地
3、创建pod 账号
pod trunk me //查看pod账号信息,如果没有账号会提示让你注册
pod trunk register xxx.qq.com 'Corn' //xxx.qq.com - 邮箱, 'Corn' - 账号名
4、创建podspec文件
pod spec create ZhPopView
会在本地库中生成一个 ZhPopView.podspec 文件
5、ZhPopView.podspec 编辑
Pod::Spec.new do |spec|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# These will help people to find your library, and whilst it
# can feel like a chore to fill in it's definitely to your advantage. The
# summary should be tweet-length, and the description more in depth.
#
spec.name = "ZhPopView" #存储库名称
spec.version = "1.0.0" #版本号,与tag值一致
spec.summary = "ZhPopView summary: 不同弹框效果" #简介
spec.description = "ZhPopView description: 不同弹框效果" #描述
spec.homepage = "https://github.com/cornZhou/ZhPopView" #项目主页,不是git地址
spec.license = { :type => "MIT", :file => "LICENSE" } #开源协议
spec.author = { "ZhouHuan" => "1559960608@qq.com" } #作者
spec.platform = :ios #支持的平台和版本号
spec.source = { :git => "https://github.com/cornZhou/ZhPopView.git", :tag => "1.0.0" } #存储库的git地址,以及tag值
# spec.pod_target_xcconfig = {'ENABLE_BITCODE' => 'YES'} #是否支持 bitcode
# .podspec同级路径下的文件夹 xxx 可直接这样写
# spec.source_files = "xxx" 或者 spec.source_files = "xxx/*.{h,m}"
# 如果同级文件夹内有子文件夹,需要这么写,这样会加载同级文件夹内的所有文件,包括子文件夹内的文件;
# spec.source_files = "xxx/**/*.{h,m}"
# 如果只需要加载某个子文件夹目录下的文件, 一定要逐级添加
# spec.source_files = "xxx", "xxx/obj/*.{h,m}"
spec.source_files = "common/*.{h,m}" #需要托管的源代码路径
spec.requires_arc = true #是否支持ARC
# s.dependency "Masonry", "~> 1.0.0" #所依赖的第三方库,没有就不用写
# spec.exclude_files = "Classes/Exclude"
# spec.public_header_files = "Classes/**/*.h"
end
6、podspec 检测
pod lib lint --no-clean --allow-warnings
7、提交
// 提交内容
git add -A
git commit -m "commit for version 1.0.0"
git push origin master
// 打tag
git tag '1.0.0' //和 podspec 中的版本一致
git push --tags
8、trunk上传 pod spec文件
pod trunk push ZhPopView.podspec
//如果上传失败,有警告或者错误的原因可以执行下面指令
//Pod repo push 本地spec库名 本地.podsepc文件 --allow-warnings
附:https://github.com/cornZhou/ZhPopView 自己写的一个工具,已经上传 pod。