最初是想整个组件化管理的案例,借鉴了一些文章:作者:SnaiLi 地址:https://www.jianshu.com/p/ea09fa02e871 和 作者:上海_光强 地址:https://www.jianshu.com/p/59c2d2c4b737
1、创建一个git仓库用来做内部私有库的Spec Repo,命名为Pods(自己喜欢怎么命名都可以),如下图:
pods.git 用来管理控制 自己的组件.podspec 版本的
注意:一定要勾选为私有 (先有远程库,在本地构建)
当执行完毕以上的命令以后,回到仓库页面刷新,你会看到以下页面,说明成功创建README.md并上传到了git仓库了。
下面开始创建真正的私有库。
1、首先在第三方git的仓库,命名为NYKit,步骤跟上面的1和2一样的。
执行完以上的步骤,然后把项目拉下来本地,然后在本地进行开发。
我在工程目录下创建了NYKit文件夹,在这个文件夹下创建了NSString+MD5.h和NSString+MD5.m文件,如下图:
编辑完成以后,在终端执行以下命令把代码提交到远程仓库:
cd 到目标文件
git add -A
git commit -m "增加NSString+HDDmd5.h和NSString+HDDmd5.m文件"
git push origin master
如图:
2、可以通过如下代码创建podspec文件
pod spec create NYKit
3、用Xcode 或者 sublime text 打开NYKit.podspec文件进行编辑
编辑NYKit.podspec文件
#
# Be sure to run `pod spec lint NYKit.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#
Pod::Spec.new do |spec|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# These will help people to find your library, and whilst it
# can feel like a chore to fill in it's definitely to your advantage. The
# summary should be tweet-length, and the description more in depth.
#
#项目名称
spec.name = "NYKit"
#项目版本号
spec.version = "1.0.0"
#项目的描述
spec.summary = "NYKit私有库"
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
# 项目的描述
spec.description = <<-DESC
NYKit私有库
DESC
#项目的主页
spec.homepage = "https://gitee.com/ningYe_88"
# spec.screenshots = "www