1、创建索引私有库
2、查询本地索引库 pod repo
3、添加私有库索引// pod repo add 索引库名称 索引库地址
4、创建组件库
快速创建模板库 // pod lib create 组件名
5、添加组件内容并删除ReplaceMe.m文件
6、安装与测试本地库
打开上图中的Example ->Podfile 有相应的导入
运行pod install
7、修改 .podspec 文件
主要修改内容
s.name = '组件名称'
s.version = '版本号'
s.summary = '描述'
s.homepage = 'https://gitee.com/****/私有库名称'//文件地址
s.source = { :git => 'https://gitee.com/****/****.git', :tag => s.version.to_s }//下载地址
8、上传代码到仓库并添加标签(版本)
git add .
git commit -m 'firstCommit'
git remote add origin https://gitee.com/****/****.git
// 第一次push如果报错的话可以加上-f
// git push -f origin master
git push origin master
git tag '0.1.0' (0.1.0为.podspec文件中的s.version)
git push --tags
9、本地验证spec的必填字段
pod lib lint
10、远程验证
pod spec lint // 远程验证会验证 s.source 中的tag,如果此时没有打上相应的标签则会报错
11、提交podspec文件到索引库
pod repo push 索引库 组件库.podspec
12、测试搜索组件
pod search '****'
13、使用
在podfile文件中添加source
source 'https://gitee.com/索引库地址'
source 'https://github.com/CocoaPods/Specs.git'//github公有库地址
14、无法搜索到索引库
~/Library/Caches/CocoaPods/search_index.json
//远程库更新,但是无法搜索到私有库,删除此文件