如果我理解正确,你需要两者。
您将Util放在MainPodfile
中,以便它可以使用它并进行编译。
您将Util放在Main.podspec
中,这样任何安装Main的人都会自动获得Util和Main。
此外,这篇文章可能对您有用,因为它展示了如何通过subspec
.
您可以制作包含不同依赖项的多个版本的 pod。例如从文章中,以下内容.podspec
:
...
spec.default_subspec = 'Lite'
spec.subspec 'Lite' do |lite|
# subspec for users who don't want the third party PayPal
# & Stripe bloat
end
spec.subspec 'PayPal' do |paypal|
paypal.xcconfig =
{ 'OTHER_CFLAGS' => '$(inherited) -DKITE_OFFER_PAYPAL' }
paypal.dependency 'PayPal-iOS-SDK', '~> 2.4.2'
end
spec.subspec 'ApplePay' do |apple|
apple.xcconfig =
{ 'OTHER_CFLAGS' => '$(inherited) -DKITE_OFFER_APPLE_PAY' }
apple.dependency 'Stripe', '2.2.0'
apple.dependency 'Stripe/ApplePay'
end
允许以下 3 个 pod:
pod "Kite-Print-SDK", "~> 1.0"
pod "Kite-Print-SDK/PayPal", "~> 1.0"
pod "Kite-Print-SDK/ApplePay", "~> 1.0"