教你如何从0到1实现组件化架构
Making a CocoaPod
create podspec
cd ~/code # 工程目录下
$ pod spec create NAME # 创建podspec
edit NAME.podspec
e.g:
Pod::Spec.new do |s|
s.name = "ccfaxPictureBrowser"
s.version = "1.0"
s.summary = "相册浏览器"
s.description = "基于ESPictureBrowser。依赖: YYWebImage, ~> 1.0.5"
s.homepage = "http://git.oschina.net/Ccfax_YJS/ccfaxPictureBrowser"
s.license = { :type => 'MIT'}
s.author = { "Hunter" => "http://www.jianshu.com/u/c843d96298fb" }
s.platform = :ios, "8.0"
s.source = { :git => "https://git.oschina.net/Ccfax_YJS/ccfaxPictureBrowser.git", :tag => s.version }
s.source_files = "ccfaxPictureBrowser/ccfaxPictureBrowser/Classes/ESPictureBrowser/*.{h,m}"
s.dependency "YYWebImage", "~> 1.0.5"
s.requires_arc = true
end
Then
cd ~/code # 工程目录下
$ git init
$ git remote add origin https://example.com/URL/to/repo/NAME.git (e.g:"http://git.oschina.net/Ccfax_YJS/ccfaxPictureBrowser")
$ git add -A
$ git commit -m "Release 1.0"
$ git push -u origin master
$ git tag -a 1.0 -m "1.0版本"
$ git push origin 1.0
edit Target project Podfile
pod 'NAME', :path => '~/code/Pods/'
pod 'NAME', :git => 'https://example.com/URL/to/repo/NAME.git'
e.g:
##### target 'test_pod' do
#本地
pod 'PodSpecName' , :path => '../targetCodeProject' #注意:targetCodeProject/PodSpecName
#git
pod 'ccfaxPictureBrowser', :git => 'https://git.oschina.net/Ccfax_YJS/ccfaxPictureBrowser.git', :tag => '1.0'
end
Target project
$ podinstall