ps:可以同步进行
Cocoapods
1、在 github 上新建仓库

image.png
2、利用 GitHub Desktop把仓库克隆到本地

image.png

image.png
3、新建项目到该目录

image.png
4、终端执行一下命令
$ pod spec create SwiftyCommon
5、通过以上命令会生成 SwiftyCommon.podspec 文件,用Xcode打开该文件,编辑如下:
Pod::Spec.new do |s|
s.name = "SwiftyCommon"
s.version = "1.0.0"
s.summary = "Swifty Common."
s.description = "Swift common function."
s.homepage = "https://github.com/MZC0829/SwiftyCommon"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "maizhichao" => "1005756105@qq.com" }
s.platform = :ios, "8.0"
s.source = { :git => "https://github.com/MZC0829/SwiftyCommon.git", :tag => s.version }
s.source_files = "SwiftyCommon/Common.swift"
s.requires_arc = true
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
end
6、用 GitHub Desktop 把项目 commit 后,push 上去。
7、给项目打上 tag
$ git tag '1.0.0'
$ git push --tags
8、检查,在终端输入以下命令:
$ pod spec lint SwiftyCommon.podspec
9、注册 trunk
$ pod trunk register 1005756105@qq.com 'MZC0829'
10、查看自己注册信息
$ pod trunk me
11、提交
$ pod trunk push SwiftyCommon.podspec
12、OK,完毕!
Carthage
1、打开刚刚的工程,新建 Target ,选择 Framework ,新建。
2、选择刚刚新建的 SwiftyCommonFramework ,如下图添加相应的文件:

image.png
3、改名称

image.png
4、分享 Target

image.png

image.png
5、生成 framework,在项目的根目录里打开终端,运行以下命令:
$ carthage build --no-skip-current
6、用 GitHub Desktop 把项目 commit 后,push 上去。
7、给项目打上 tag
$ git tag '2.0.0'
$ git push --tags
8、更新提交
$ pod trunk push SwiftyCommon.podspec
9、OK,完毕!
网友评论