兩種方式:
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