今天來講一下cocoapods制作,網上教程很多,就不再講理論,直接操作:
1、創建倉庫:
2、將倉庫克隆本地:
git clone https://github.com/2360219637/CZCTestCode.git
3、創建.podspes文件,此處命名為CZCTestCode
$ pod spec create CZCTestCode
4、在桌面CZCTestCode目錄中創建工程(此處命名為CZCTestCode),創建共享的類
5、編輯podspec文件
Pod::Spec.new do |s| s.name = "CZCTestCode" s.version = "1.0.0" s.summary = "一個建立pod倉庫的簡單demo." s.description = <<-DESC 這只是一個建立pod倉庫的簡單demo,並沒有實際的意思。教學使用。 DESC s.homepage = "https://github.com/2360219637/CZCTestCode" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "陳志超" => "2360219637@qq.com" } s.platform = :ios, "7.0" s.source = { :git => "https://github.com/2360219637/CZCTestCode.git", :tag => s.version } s.source_files = "Classes", "CZCTestCode/CZCTestCode/Classes/**/*.{h,m}" s.requires_arc = true end
6、上傳git並打tag
$ git add -A && git commit -m "創建版本 1.0.0." $ git tag '1.0.0' $ git push --tags $ git push origin master
7、驗證podspec
$ pod spec lint
驗證成功會出現以下提示:
8、pod主干注冊
pod trunk register 2360219637@qq.com "czc"
9、發布你的pod
pod trunk push CZCTestCode.podspec
這個過程等待時間較長,成功截圖:
10、完成,此時終端可搜索到自己創建的pod庫