步骤
1、在github或者码云等创建远程私有索引库 YLeSpecs

2、在github或者码云等创建远程私有代码库YLeBase

3、查看本地pod库 pod repo

4、创建本地私有索引库 pod repo add YLeSpecs(本地索引库名字) git@github.com:AlexYangLe/YLeSpecs.git(远程私有索引库url)

此时已经创建本地私有索引库 pod spec 查看

我们可以看到此时我们已经生成了本地索引库
5、在本地生成私有代码库 pod lib create YLeBase(本地私有代码库名称)

6、在本地生成的私有代码库中添加私有代码,在/YLeBase/Classes 下面添加私有库代码,我添加了persion.h和persion.m。

我们查看一下:

7、在没有pod install的时候我们可以在项目中看到:

接下来去Example下面 pod install 更新,看工程下面是不是有所添加的分类工程

我们可以看到此时的项目中是

8、修改YLeBase.podspec ,主要是这几项:s.summary、s.version 、s.description、s.homepage、s.source 这几项,主要是s.version、s.source 这两项

9、验证本地pod是否正确
pod lib lint --allow-warnings

10、将本地私有代码库提交到远程私有代码库
git add .
git commit -m "私有代码库提交"
git remote add origin git@gitee.com:alexyang563/YLeBase.git
git push -u origin master

注:这是远程库是新创建,没有东西,有东西的时候我们需要git pull
11、提交tag
git tag ‘0.1.0’
git push --tags
12、验证远程pod
pod spec lint --allow-warnings

13、将本地私有代码库的YLeBase.podspec 提交到本地私有索引库
pod repo push YLeSpecs(本地私有索引库名字) YLeBase.podspec

本地私有索引库中存在:

14、去远程的私有代码索引库查看是否有YLeBase.podspec,有代表成功了

15、接下来要引用的podfile文件中

source="git@github.com:AlexYangLe/YLeSpecs.git"
我们才能引用自己的私有库
假如要引用共有索引库我们需要在podfile之中添加
source="https://github.com/CocoaPods/Specs.git"

pod install 便可以引用。
此时基本完成
个人公众号:iOS开发blog,多谢关注
网友评论