發(fā)布自己的iOS庫到Github,并支持Cocoapods

1 創(chuàng)建自己的github賬號,并提交Mac電腦的ssh證書,新建自己的倉庫.(自己去搞)

2.把自己本地的代碼提交到github倉庫

打開終端
1. cd 文件路徑
2.git init 
3.git status //查看狀態(tài)
4.git add .  //添加到本地倉庫
5.git commit -m '說明'
6.git push 
7.git tag 0.1.1 //這個(gè)tag值最好和版本號一致
8.git push --tags
//第一次提交需要把第6步換為下面的兩步
1.git remote add origin https://github.com/GithubName/repository Name.git //這個(gè)地址可以在github倉庫主頁位置獲取
2.git push -u origin master //這兩步第一次會需要你的github賬號密碼

3.支持cocoapods

//創(chuàng)建cocoapods賬號
//注冊
pod trunk register EmailAdress 'your pods name'
eg. pod trunk register xxxxxxxxxx@qq.com 'jack'
//此時(shí)郵箱會收到一封郵件,點(diǎn)擊確認(rèn),然后繼續(xù)終端驗(yàn)證
pod trunk me
pod spec create yourRepositoryName
//這個(gè)創(chuàng)建完成會有模板出來,但是可以在github找一個(gè)優(yōu)秀的框架的podspec研究下,或者直接拷貝出來修改下
pod spec lint  
//從本地和遠(yuǎn)程podspec文件是否合格
pod lib lint
//從本地查看podspec文件是否合格
pod trunk push yourRepositoryName.podspec 
//提交到cocoapods

4.難搞的spec文件

//這里復(fù)制了SVProgressHUD的podspec文件用于分析(僅用于技術(shù)學(xué)習(xí))
Pod::Spec.new do |s|
  s.name     = 'SVProgressHUD'  
  s.version  = '2.2.5'  
  s.ios.deployment_target = '8.0'
  s.tvos.deployment_target = '9.0'
  s.license  =  { :type => 'MIT', :file => 'LICENSE' }
  s.summary  = 'A clean and lightweight progress HUD for your iOS and tvOS app.'
  s.homepage = 'https://github.com/SVProgressHUD/SVProgressHUD'
  s.authors   = { 'Sam Vermette' => 'hello@samvermette.com', 'Tobias Tiemerding' => 'tobias@tiemerding.com' }
  s.source   = { :git => 'https://github.com/SVProgressHUD/SVProgressHUD.git', :tag => s.version.to_s }

  s.description = 'SVProgressHUD is a clean and easy-to-use HUD meant to display the progress of an ongoing task on iOS and tvOS. The success and error icons are from Freepik from Flaticon and are licensed under Creative Commons BY 3.0.'

  s.source_files = 'SVProgressHUD/*.{h,m}'
  s.framework    = 'QuartzCore'
  s.resources    = 'SVProgressHUD/SVProgressHUD.bundle'
  s.requires_arc = true
end

//如果你的庫內(nèi)不存在已有的SDK,那OK,你模仿SVProgressHUD基本就夠用了,搞iOS一看基本上就明白
//項(xiàng)目里面存在SDK或者只想把項(xiàng)目里面的SDK發(fā)布到cocoapods,怎么辦吶,添加一行
s.vendored_frameworks = "項(xiàng)目名字/**/已存在的SDK名字.framework"http://**表示所有子路徑
//然后刪除 s.source_files  這一行代碼,重新提交代碼

剛開始研究SDK開發(fā),此篇文章會持續(xù)更新記錄.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容