1.將代碼上傳至GitHub
1.1創(chuàng)建倉庫稽犁,并且添加 MIT License,后面上傳cocoapods需用到
1.2拿到自己的倉庫地址陨帆,如https://github.com/zhiyuehl/HLChartView.git曲秉。下載到sourcetree。上傳自己的代碼疲牵,HLChartView文件就是我們需上傳到cocoapods的庫
2.創(chuàng)建podspec文件承二,上傳cocoapods
2.1創(chuàng)建podspec文件,創(chuàng)建成功如上圖。進(jìn)入到你的文件纲爸,
然后使用下面命令,然后就如上圖了亥鸠。
pod spec create HLChartView
2.2 使用xcode打開 HLChartView.podspec文件,修改其中部分代碼如下
s.name? ? ? ? = "HLChartView"
s.version? ? ? = "1.0.0"
s.summary? ? ? = "chart collection"
s.description? = <<-DESC
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? A collection of t highly custom chart (histogram, pie chart, line chart)
? ? ? ? ? ? ? ? ? ? ? ? ? ?DESC
s.homepage? ? = "https://github.com/zhiyuehl/HLChartView"
s.license? ? ? = "MIT"
s.author? ? ? ? ? ? = { "zhiyuehl" => "775445353@qq.com" }
s.ios.deployment_target = "8.0"
s.source? ? ? = { :git => "https://github.com/zhiyuehl/HLChartView.git", :tag => "#{s.version}" }
s.source_files? = "ChartDemo/HLChartView/*.{h,m}"
s.requires_arc = true
s.description :簡介识啦,注意格式负蚊。不能再同一行編輯
s.homepage:你的庫的github地址
s.author:作者。沒有cocoapods賬號(hào)袁滥。請先注冊 終端使用? pod trunk register 郵箱地址 ‘用戶名’ ,成功后就去看自己郵件
pod trunk register 775445353@qq.com 'zhiyuehl'
可以使用 pod trunk me查看自己的cocoapods賬號(hào)
s.license:證書盖桥,上面創(chuàng)建的MIT
s.source:你的庫下載地址https://github.com/zhiyuehl/HLChartView.git
s.source_files? :上傳cocoapods的庫文件 ,相對(duì)于HLChartView.podspec的文件路徑题翻。如果在同級(jí)揩徊,直接
"HLChartView/*.{h,m}"就行
2.3修改完成后,然后終端
pod lib lint HLChartView.podspec --allow-warnings
--allow-warnings忽略警告嵌赠,請確保自己的podspec文件的正確性
當(dāng)看到當(dāng)看到HLChartView passed validation之后塑荒,就說明驗(yàn)證通過了。
2.4.github上創(chuàng)建release
2.5上傳至cocoapods
pod trunk push HLChartView.podspec --allow-warnings
等待姜挺。然后就大功告成了齿税。
2.6 tell your friends ?高度自定義圖表HLChartView