打造你的远程私有库(私有库分支)
有些时候我们其实在下载组件的时候可能值需要其中的某一部分而不是将所有的组件都下载下来而是需要其中的某一部分,下面我们在cocoapods里面来看看AFN的结构

我们可以看到我们的AFN将所有的组件分成了五层,Serialization、Security、Reachability、NSURLSession、UIKit
那么同样的在我们的基础组件中分为Base、Category、Network、Tool四层

只在需要使用到对应的库才下载下来,而不是将基础组件中的所有内容都下载下来
按照之前对远程私有索引库升级的步骤再来操作一遍,记得要更改我们版本号哦,这次我们着重要注意的是需要修改.spec文件中source_files属性,我们在原来的基础上扩展几个子库

然后将修改过后的.spec文件提交到本地代码仓库中并且推送到远程私有代码仓库中

完毕之后习惯性还是要做以下本地和远程的校验才行,这个地方我不再贴出来了,一切就绪之后将我们的描述文件推送到我们远程私有索引库当中

上传完毕之后,使用pod search来查看以下我们的最新版本的TZSoundBase的框架信息

我们发现确实按照我们的设想将基础组件中的所有内容都按照文件夹划分好了,接下来我们进入项目文件夹下,对podfile文件进行修改,我们在这里仅仅需要下载其中的Base和Category两个文件夹中的东西

回到项目中,首先把我们的podfile.lock文件删除掉,然后使用pod install命令来安装我们的库,我们可以看到现在安装的是我们最新的库

我们再回到我们的项目中查看是不是只安装了我们指定的库

这里我们看到安装的只有我们前面在podfile文件中指定的Base和Category两个文件夹的东西,那么今天关于远程私有库分支的内容就讲到这里。