iOS组件化实践过程

  1. 创建私有库的索引文件repoA:
    pod repo add repoA repoA_url
  2. 创建私有库podA:
    pod lib create podA
  3. 编辑podA代码
  4. 远程仓库新建项目podA,注意不要勾选创建.md文件那些选项
  5. 打开podA.podspec文件,编辑好信息(可参考最后的example)
  6. podA推送到远程:
    git remote add origin https://github.com/JW-chenjingwei/podA.git
    git branch -M main
    git push -u origin main
  7. 打上tag:
    git tag 0.1.0
    git push —tag
  8. 检查podA是否通过:
    pod repo lint podA
  9. 把podA和私有库索引repo关联起来
    pod repo push repoA podA.podspec
  10. 检查是否成功:
    pod search podA

Example:podA.podspec信息



Pod::Spec.new do |s|
  s.name             = 'PersonalEnglishLib'
  s.version          = '0.1.0'
  s.summary          = '这是一个说英语很牛逼的框架,逼很牛,你忍一下'

# 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!

  s.description      = <<-DESC
TODO: Add long description of the pod here.
                       DESC

  s.homepage         = 'https://github.com'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { ‘XX’ }
  s.source           = { :git => 'https://github.com/JW-chenjingwei/PersonalEnglishLib.git', :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/'

  s.ios.deployment_target = '13.0'
  s.swift_version = '5.0'
  s.source_files = 'PersonalEnglishLib/Classes/**/*'
  
  # s.resource_bundles = {
  #   'PersonalEnglishLib' => ['PersonalEnglishLib/Assets/*.png']
  # }

  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  # s.dependency 'AFNetworking', '~> 2.3'
end
12. 可能会出现的错误提示,要求输入github账号密码时提示需要使用access tokens,解决方法就是在github的devlep settiing里创建access tokens,在电脑里的钥匙串中搜索github,删除之前保存的github账号密码,下次要求输入密码的时候输入access tokens即可

你可能感兴趣的:(iOS组件化实践过程)