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/<TWITTER_USERNAME>'

  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即可
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 最近在学习vue.js的时候发现,vue的组件化的思想对于编写代码是一个非常有用的事情。 首先为什么需要组件化? ...
    helloWalle阅读 7,629评论 0 6
  • 组件化的优点 为什么需要组件化开发?1.将不同功能、模块的代码分离出来,有利于大型项目的解耦,像插件似的组装整个复...
    许久以前阅读 3,709评论 2 3
  • 最近在学习vue.js的时候发现,vue的组件化的思想对于编写代码是一个非常有用的事情。 首先为什么需要组件化? ...
    拂晓的云阅读 12,023评论 6 23
  • 最近刚换一个新公司,比较清闲些,就搜索了一些私有pod的制作资料,发现现有的一些文章大多数重在思想而忽略了实战细节...
    summer_maimaiti阅读 4,288评论 0 0
  • 因项目业务的不断发展,应用的代码体积越来越大,代码耦合也较为严重,所以考虑先对各模块进行解耦,然后通过pod私有库...
    炎成阅读 12,666评论 2 23

友情链接更多精彩内容