制作 pod 库

创建 git 仓库

  • 克隆至本地

创建 podspec

  • 就是 Podfile 对应的
pod spec create TestLibName

官方参考
示例参考、查询

修改 podspec 内容

  • 注释已经非常清楚了

需要把自己的提交打好 tag,对应 podspec 里的 version

检查自己的 pod 库是否可用

pod spec lint TestLibName.podspec

提交至线上

pod trunk push TestLibName.podspec

没用过的需要注册一一下
$ pod trunk register 邮箱 '昵称' --description=' 这里写描述'

搜索看看

  • 更新不一定及时,可能与使用了淘宝源有关,使用下面的简单搜索即可
pod search TestLibName --simple

附录

  • 基础的 podspec
Pod::Spec.new do |s|

  s.name         = "CZLibrary"
  s.version      = "0.0.2"
  s.summary      = "cz self library summary"
  s.description  = "cz self library description"
  s.homepage     = "https://github.com/JuYiWei/CZLibrary"
  s.license      = "MIT"
  s.author       = { "juyw" => "757832801@qq.com" }
  s.platform     = :ios, "9.0"
  s.source       = { :git => "https://github.com/JuYiWei/CZLibrary.git", :tag => "#{s.version}" }

  s.source_files  = "CZLibrary/CZLibrary/Lbirary/*.{h,m}"
  s.subspec 'Category' do |ss1|
    ss1.subspec 'UIKit' do |sss1|
      sss1.source_files  = "CZLibrary/CZLibrary/Lbirary/Category/UIKit/*.{h,m}"
    end
    ss1.subspec 'Foundation' do |sss2|
      sss2.source_files  = "CZLibrary/CZLibrary/Lbirary/Category/Foundation/*.{h,m}"
    end
  end

  # s.exclude_files = "Classes/Exclude"
  # s.resources = "Resources/*.png"

  s.requires_arc = true
end