1. 制作類庫
我也是按照別人的教程來學(xué)習(xí)制作的答姥,先上鏈接: 參考鏈接
步驟1: 創(chuàng)建項(xiàng)目
Xcode -> File -> New -> Project...
-> 項(xiàng)目類型: Cocoa Touch Framework
-> 填寫你的項(xiàng)目名 -> Language選 Swift
MARK:記得要勾選 Create Git repository on My Mac項(xiàng)
步驟2: 刪除無用文件
默認(rèn)生成的 項(xiàng)目名.h文件不需要,刪除掉
步驟3: 添加你的代碼文件
公開的類谚咬,屬性,方法都需要public修飾择卦,否則對外不可見
2. 提交github
-> github網(wǎng)站上創(chuàng)建你的repository
-> 打開終端敲长,進(jìn)入你的類庫項(xiàng)目根目錄
-> 執(zhí)行本地git和github上的repository關(guān)聯(lián)操作
<p><code>
命令:git remote add origin https://github.com/你的github用戶名/你的repository項(xiàng)目名.git
</code>.</p>
-> 本地代碼上傳github
<p><code>
命令:git push -u origin master
</code>.</p>
3. 提交cocoapods管理
-> 項(xiàng)目根目錄下創(chuàng)建文件 項(xiàng)目名.podspec
-> 文件關(guān)鍵內(nèi)容如下:
<p><code>
Pod::Spec.new do |s|
s.name = "ImageCarouselView"
s.version = "1.0.0"
s.summary = "項(xiàng)目簡介"
s.description = "詳細(xì)的項(xiàng)目描述"
s.homepage = "項(xiàng)目介紹頁"
s.license = "type: 'MIT', file='LICENSE.md'"
s.author = { "your github name" => "your github email" }
s.source = { :git => "https://github.com/your github name/projectName.git", :tag => "#{s.version}" }
s.source_files = "Sources/*.{h,swift}"
s.ios.deployment_target = "8.0"
s.frameworks = "UIKit"
end
</code>.</p>
參考鏈接:(http://blog.csdn.net/bluefish89/article/details/48030941)
-> 項(xiàng)目制作Release Tag并上傳github
<p><code>
git tag -a 1.0.0 -m "balabalabala..."
git push origin 1.0.0
</code></p>
-> 刪除tag
刪除一個(gè)本地標(biāo)簽:git tag -d <tag name>
刪除一個(gè)遠(yuǎn)程標(biāo)簽:git push origin :refs/tags/<tag name>
細(xì)節(jié)看這里祈噪,很詳細(xì)的教程
錯(cuò)誤處理教程
-> cocoapods注冊
<p><code>
pod trunk register [EMAIL] [NAME]
</code>.</p>
-> 檢查.podspec文件
<p><code>
pod spec lint [YOUR PROJECT NAME].podspec
</code>.</p>
-> 提交項(xiàng)目到cocoapods
<p><code>
pod trunk push [YOUR PROJECT NAME].podspec
</code>.</p>