步驟
1、在github或者碼云等創(chuàng)建遠程私有索引庫 YLeSpecs

image.png
2、在github或者碼云等創(chuàng)建遠程私有代碼庫YLeBase

image.png
3、查看本地pod庫 pod repo

image.png
4、創(chuàng)建本地私有索引庫 pod repo add YLeSpecs(本地索引庫名字) git@github.com:AlexYangLe/YLeSpecs.git(遠程私有索引庫url)

image.png
此時已經(jīng)創(chuàng)建本地私有索引庫 pod spec 查看

image.png
我們可以看到此時我們已經(jīng)生成了本地索引庫
5、在本地生成私有代碼庫 pod lib create YLeBase(本地私有代碼庫名稱)

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

imaage
我們查看一下:

image.png
7、在沒有pod install的時候我們可以在項目中看到:

image.png
接下來去Example下面 pod install 更新,看工程下面是不是有所添加的分類工程

image.png
我們可以看到此時的項目中是

image.png
8、修改YLeBase.podspec ,主要是這幾項:s.summary、s.version 、s.description、s.homepage、s.source 這幾項,主要是s.version、s.source 這兩項

image.png
9、驗證本地pod是否正確
pod lib lint --allow-warnings

image.png
10、將本地私有代碼庫提交到遠程私有代碼庫
git add .
git commit -m "私有代碼庫提交"
git remote add origin git@gitee.com:alexyang563/YLeBase.git
git push -u origin master

image.png
注:這是遠程庫是新創(chuàng)建,沒有東西,有東西的時候我們需要git pull
11、提交tag
git tag ‘0.1.0’
git push --tags
12、驗證遠程pod
pod spec lint --allow-warnings

image.png
13、將本地私有代碼庫的YLeBase.podspec 提交到本地私有索引庫
pod repo push YLeSpecs(本地私有索引庫名字) YLeBase.podspec

image.png
本地私有索引庫中存在:

image.png
14、去遠程的私有代碼索引庫查看是否有YLeBase.podspec,有代表成功了

image.png
15、接下來要引用的podfile文件中

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

image.png
pod install 便可以引用。
此時基本完成
個人公眾號:iOS開發(fā)blog,多謝關(guān)注