主要步驟
- 剝離宿主工程代碼到組件中;
- 解決依賴:把宿主工程的Podfile文件中的依賴關(guān)系,轉(zhuǎn)移到組件的podspec文件中;
- 測(cè)試Example代碼。
詳細(xì)步驟
####### 1. 創(chuàng)建模板pod lib create MainModule,骨架組件化,拖入骨架文件;(創(chuàng)建庫(kù)模板)

####### 2.修改podspec和Podfile: 解決組件間依賴問題,比如業(yè)務(wù)組件依賴基礎(chǔ)組件的分類子庫(kù);(修改podspec文件)
2.1 搜索一下基礎(chǔ)組件 pod search LFProject_my0707;

2.2 podspec文件添加庫(kù)依賴,Podfile中沒有加公私庫(kù)source
// 依賴大庫(kù)LFProject_my0707中的子庫(kù)Category
s.dependency 'LFProject_my0707/Category'
// Podfile:
source 'https://git.oschina.net/lovell123/lfspec_my0707.git'
source 'https://github.com/CocoaPods/Specs.git'
如果Podfile中沒有加公私庫(kù)source會(huì)報(bào)錯(cuò):
[!] Unable to find a specification for `LFProject_my0707/Category` depended upon by `LFFMMain`.
####### 3.測(cè)試:Example測(cè)試工程AppDelegate文件加入創(chuàng)建TabBarController的代碼,編譯報(bào)錯(cuò)根據(jù)路徑找不到某個(gè)xib。
報(bào)錯(cuò)解決辦法在下一篇資源的加載。

####### 4.上傳代碼、打標(biāo)簽、推送podspec文件
git status
git add .
git commit -m '1'
git remote
git remote add origin http......
git push origin master
git tag
git tag '0.1.0'
git push --tags
pod lib lint
pod spec lint
pod repo
pod repo push <repo name> <spec file name>