美文网首页
2018-11-03 记录一次cocoapod的私有库的创建

2018-11-03 记录一次cocoapod的私有库的创建

作者: Life淡淡 | 来源:发表于2018-11-03 09:30 被阅读5次

最近到新的公司,准备考虑把公司的项目给组件化。

主要参考的文章地址:https://casatwy.com/modulization_in_action.html 

创建私有库是组件化的一部分

创建cocoapod管理项目

1:在git仓库里面创建一个管理.codspace文件的仓库

 pod repo add Repohttps://gitee.com/TestGGG/Repo.git

2:在终端里面  pod repo add Repohttps://gitee.com/TestGGG/Repo.git 

3:到pod的文件夹里面查看有没有加入进来

创建项目的私有库

1:创建私有库的代码仓库 

https://gitee.com/TestGGG/DDDTest

到本地,创建项目

在项目的主目录下面创建podspec文件 pod spec create +文件名

主目录 FFFA

name:私有库的名字

version:版本的 ===》git上面的tag

desctiption:描述

s.source = { :git => "https://gitee.com/TestGGG/DDD_B.git", :tag => "#{s.version}" }

s.source_files = "DDDB/DDDB/A/**/*.{h,m}"

# s.dependency "JSONKit", "~> 1.4"

在项目创建pod私有库需要的文件的文件夹

代码push到git上去记得带上对应version ====》tag

//检查podspec文件格式是否正确

pod lib lint

 pod lib lint --use-libraries --allow-warnings

//检查私有库索引是否正确

pod spec lint --use-libraries --allow-warnings

将podspec文件推到索引库

pod repo push Repo FFFA.podspec --use-libraries --allow-warnings

创建主项目引入私有库

1:创建git

2:创建项目 cocoapod 主要是podFile

# Uncomment the next line to define a global platform for your project

# platform :ios, '9.0'

source 'https://gitee.com/TestGGG/Repo.git' 管理项目的源

source 'https://github.com/CocoaPods/Specs.git' # CocoaPods 官方 Spec 索引库

target 'Mast' do

  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks

  # use_frameworks!

  # Pods for Mast

  pod 'DDDB'

  pod 'FFFA'

  target 'MastTests' do

    inherit! :search_paths

    # Pods for testing

  end

  target 'MastUITests' do

    inherit! :search_paths

    # Pods for testing

  end

end

后面就是解耦和项目的模块拆分

相关文章

网友评论

      本文标题:2018-11-03 记录一次cocoapod的私有库的创建

      本文链接:https://www.haomeiwen.com/subject/xctkxqtx.html