创建库
# 构建自己的库目录这里是HqLib
mkdir HqLib && cd HqLib
mkdir Source
#创建pod描述文件
pod spec create HqLib
#修改 HqLib.podspec 改成自己相应的信息
# 添加自己的代码如:
touch HqLib.h
创建git仓库,并添加github地址
# 初始化git仓库
git init
git add . && git commit -m "init"
# 在github上创建HqLib仓库,添加github远程地址
# git 默认主分支为master,目前在github上已经变为main
# 重命名分支
git branch -m master main
# 添加远程分支
git remote add origin https://github.com/HeHuiqi/HqLib.git
git remote -v
git pull origin main
git add . && git commit -m "update"
git push --set-upstream origin main
#创建tag并推送到github
git tag 0.0.1 && git push origin tag 0.0.1
使用
#在自己的项目中创建Podfile
pod init
编辑Podfile
#用于本地开发目录
# pod 'HqLib', :path=> './HqLibs/HqLib'
#当提交到github时,使用这种方式,因为我们没有发布的公共仓库,所有用这种方式
pod 'HqLib', :git=> 'https://github.com/HeHuiqi/HqLib.git'
网友评论