iOS 组件化私有库

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
//远程库更新,但是无法搜索到私有库,删除此文件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值