两种方式:
1,
# 使用关键字abstract_target,使用多个target共享同一个pod,这里是common_pod
abstract_target 'common_pod' do
pod 'AFNetworking'
# targetA 单独拥有
target 'targetA' do
pod 'Masonry'
end
# targetB 单独拥有
target 'targetB' do
pod 'SDWebImage'
end
end
2,
# 共同的pod
def commonPods
pod 'Masonry', '~> 1.1.0'
end
# targetA
target 'targetA' do
commonPods
pod 'AFNetworking', '~> 3.2.1'
end
# targetB
target 'targetB' do
commonPods
pod 'YYModel'
end