创建私有pod库

一, 创建Github的

在Gitthub创建一个pod工程的名称martshow的项目,使用git clone到本地

1
iMac-tortoise:martshow tianww$ git clone https://github.com/Tweiwei497435786/martshow.git

二, 创建本地pod工程

只要输入pod lib create <项目名称>命令即可完成初始项目的搭建:

1.执行命令pod lib create martshow_public,具体操作如下实例:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
iMac-8:martshow tianww$ pod lib create martshow_public
Cloning `https://github.com/CocoaPods/pod-template.git` into `martshow`.
Configuring martshow template.

------------------------------

To get you started we need to ask a few questions, this should only take a minute.

If this is your first time we recommend running through with the guide:
- http://guides.cocoapods.org/making/using-pod-lib-create.html
( hold cmd and double click links to open in a browser. )


What language do you want to use?? [ ObjC / Swift ]
> objc

Would you like to include a demo application with your library? [ Yes / No ]
> yes

Which testing frameworks will you use? [ Specta / Kiwi / None ]
> no

Possible answers are [ Specta / Kiwi / None ]
> none

Would you like to do view based testing? [ Yes / No ]
> no

What is your class prefix?
> BB

以上操作后,一个简单的私有pod库项目搭建完成。进入目录,我们会看到如下目录文件:

1
2
Example			Pod			_Pods.xcodeproj
LICENSE README.md martshow.podspec

我们添加的文件需要放在Pod/Classes目录,我们可以打开Exaple文件,双击.xcworkspace文件,这个就是我们的pod工作工程,也可以在如下图中加入文件:

Editor preferences pane

三, 提交本地pod库到远端

就这样我们的一个私有pod库创建成功了,然后通过git命令或者git命令工具SourceThree上传代码到远端,其它pod工程需要引用当前的私有pod库可直接在podfile中添加引用

1
2
3
iMac-tortoise:martshow tianww$ git add marshow/
iMac-tortoise:martshow tianww$ git commit -a -m "添加文件"
iMac-tortoise:martshow tianww$ git push

相关参考:

  1. 使用CocoaPods开发并打包静态库
  2. CocoaPods版本升级