美文网首页ios-需要掌握的知识点
iOS Swift 在多target中优雅的使用podfile

iOS Swift 在多target中优雅的使用podfile

作者: A_rcher34 | 来源:发表于2020-04-20 16:37 被阅读0次

当有多个target时,需要考虑不同target之间共用的pod,以及每个target单独的pod。避免重复书写。

下面以两个target为例,其他个数按此类延伸即可。

# 说明平台是ios,版本是9.3
platform :ios, '9.3'

def common_pods
  pod 'SnapKit'
end

def only_Project0_pods
  pod 'GoogleSignIn' # 谷歌登录
end

def only_Project1_pods
  pod 'WechatOpenSDK' # 微信登录
end

target 'Project0' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Project0
  common_pods
  only_Project0_pods
end

target 'Project1' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Project1
  common_pods
  only_Project1_pods
end

only部分也可直接写在target中。看个人喜好。

参考文献

相关文章

网友评论

    本文标题:iOS Swift 在多target中优雅的使用podfile

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