前提:假设你本地已经安装好cocoapods环境
私有库制作
1.新建项目
pod lib create 项目名称
2.git/gitee(推荐gitee)建空仓库
a.获取远端仓库地址
b.git clone URL到本地磁盘
c.把 b clone到本地的.git目录copy到1创建的项目根目录下
d.把 upload.sh脚本copy到1创建的项目根目录下(如下是示例脚本)
3.在 1 创建的项目里新增Object-C/Swift 工具类或组件
a.新增完工具类或组件勿忘修改项目根目录下 eg:NIUIToolsPodSwift.podspec 文件里内容
b.勿忘修改upload.sh脚本里内容
4.终端里执行upload.sh脚本直至 私有库 提交到git仓库 并且 同步私有索引库成功
5.注意 pod lib create 项目名-项目名称里不要有奇葩的特殊符号 - / _ 都不行
6.swift私有工具类 或者 库里函数、属性变量要是允许外抛 勿忘添加 public关键词,要是 swift 允许 Object-C 访问 勿忘添加 @objc
普通项目引入个人私有库
1.普通项目Podfile示例如下
# 私有索引库地址
source 'https://gitee.com/nixs/nispec.git'
# github公有索引库地址
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
target 'swift002' do
use_frameworks!
# 屏蔽所有第三方框架警告
inhibit_all_warnings!
#注意如下格式
#pod 'lib', : git => 'url', :tag => 'version'
#注意:只能使用 “ => ” 符号;
#pod 'NIUIToolsPodSwift', :git => 'https://gitee.com/nixs/niuitools-pod-swift.git', :tag => '0.1.2'
pod 'NIUIToolsPodSwift','0.1.2'
pod 'NIUIToolsPod'
# 更改所有第三方框架 Target 版本
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
end
需要私有库制作全流程脚本的私信个人WX: wvqusrtg