精细化Podfild配置

1、abstract_target

abstract_target:定义一个新的抽象目标,可用于方便的目标依赖继承。

abstract_target 'abstract_pod' do
  # 双端都有的模块可以写在这三个方法里
  thirdparty  

  # Car端pod的依赖
  target 'Cars' do
    tyt_common
    tyt_cars
  end
  
  # 货端pod的依赖
  target 'Goods' do
    tyt_common
    tyt_goods
  end
  
end

2、共用的三方

def thirdparty
  pod 'AAChartKit', '5.0.4'
  pod 'AFNetworking', '4.0.1.5'
  pod 'lottie-ios'
end

3、包含的两个工程

Car工程

def tyt_cars
  # 车主版特有的模块写这里
  pod 'ZHBuyCars','0.1.1'
end

Goods工程:

def tyt_goods
  # 货站版特有的模块写这里
  pod 'ZHBuyGoods','0.1.1'
end

4、post_install

This hook allows you to make any last changes to the generated Xcode project before it is written to disk, or any other tasks you might want to perform.
这个钩子允许你对生成的Xcode项目进行最后的修改,然后再将其写入磁盘,或者执行其他你想要执行的任务。

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['GCC_ENABLE_OBJC_GC'] = 'supported'
    end
  end
end
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容