I'm struggling with creating a cocoapod spec including multiple sub specs where each sub spec should be its own framework. Basically I have the following spec:
Pod::Spec.new do |s|
s.name = 'BMCommons'
...
s.default_subspec = 'BMCore'
s.subspec 'BMCore' do |s_core|
s_core.header_dir = 'BMCore'
...
end
s.subspec 'BMUICore' do |s_uicore|
s_uicore.header_dir = 'BMUICore'
...
end
end
Now I would like this to result in a BMCore.framework and BMUICore.framework instead of one BMCommons.framework. Is this possible or do I need to create multiple specs to achieve this?
In short: no, you can't have subspecs that result in different frameworks, because - as the name implies - it's a subspec, that is part of something. From the cocoapod docs:
subspec
Represents specification for a module of the library.
But it will result in separate frameworks internally when you use it in a project, their filenames being BMCommons-BMCore and BMCommons-BMUICore. Their actual framework name you import will remain BMCommons.
You can try this out by creating a project with 2 targets, and in the Podfile for one target you add the first subspec, and for the other the second one. After a pod install you should look the targets in the Pods project, there are the generated frameworks by cocoapod.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With