Reputation: 645
I am trying to declare a podspec which has an optional subspec dependency. The intention is that a few clients which may need this SubsSpecDepenedency
can include OptionalSubSpec
as well and the rest of clients gets only the main
spec and it's dependencies.
My Spec looks somethings like this :
Pod::Spec.new do |s|
s.name = 'main'
s.version = '123234'
s.author = { 'name' => 'email@' }
s.license = { "Confidential" }
s.homepage = 'https://....'
s.source = { :http => "URL-for-framework"}
s.summary = 'Dynamic framework'
s.source_files = 'dummy.m'
s.preserve_paths = '*'
s.ios.deployment_target = '9.0'
s.dependency 'dependency1', "123"
s.default_subspec = :none
s.subspec 'OptionalSubSpec' do |ss|
ss.dependency 'SubsSpecDepenedency', "456"
end
end
I do not want the OptionalSubSpec
to be also installed along with pod main
but even after specifying the s.default_subspec = :none
as mentioned in the cocoa pod guide the SubsSpecDepenedency is being installed when i run pod install
for pod main
only.
How can I declare an optional dependency for my podsepc which is not always installed when the main/master spec is installed.
Upvotes: 0
Views: 2365
Reputation: 29572
Divide the pod into two subspecs. Put everything you want to always install in the default_subspec
. Put the optional bits in the other subspec.
Then the other subspec will only be installed if explicitly requested in the Podfile
.
Upvotes: 1