iOS Swift 在多target中优雅的使用podfile
2020-04-20 本文已影响0人
A_rcher34
当有多个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中。看个人喜好。