I have a MyProduct.xcframework that I distribute with Cocoapods in a podspec that relies on the vendored_frameworks field.MyProduct.xcframework also depends on another XCFramework called MyProductCore.xcframework.
At this point I would like to build extra features upon these 2 frameworks and to distribute them as Swift source files (that import MyProductCore.xcframework).
In a nutshell, here is the structure of my repo:
- Frameworks folder: MyProduct.xcframework, MyProductCore.xcframework
- FeatureA folder: SomeFunctionality xcode project
- MyProduct.podspec
- FeatureA.podspec
To consume MyProduct and its optional features (such as FeatureA) in a podfile, it looks like this:
pod 'MyProduct' ...pod 'FeatureA/SomeFunctionality' ...
The problem is when I run pod install
in a test app, I get the following error:
Downloading dependencies-> Installing MyProduct (1.0.0)-> Installing FeatureA (1.0.0) - Running pre install hooks[!] The 'Pods-DemoApp' target has frameworks with conflicting names: MyProductCore.xcframework.
This is the contents of MyProduct.podspec (showing only the relevant bits):
Pod::Spec.new do |s| s.name = "MyProduct" s.version = "1.0.0" s.platform = :ios s.ios.deployment_target = '12.0' s.swift_versions = ['5.9.2'] s.source = { :git => "path/to/my/repo.git", :tag => "1.0.0" } s.requires_arc = true s.vendored_frameworks = 'Frameworks/MyProduct.xcframework', 'Frameworks/MyProductCore.xcframework'end
And this is the FeatureA.podspec:
Pod::Spec.new do |s| s.name = "FeatureA" s.version = "1.0.0" s.platform = :ios s.ios.deployment_target = '12.0' s.swift_versions = ['5.9.2'] s.source = { :git => "path/to/my/repo.git", :tag => "1.0.0" } s.requires_arc = true # The default subspec which will be installed automatically. # Note that it is a mandatory dependency for the optional subspecs defined below. s.default_subspec = 'Core' # Core subspec s.subspec 'Core' do |core| core.vendored_frameworks = 'Framework/MyProductCore.xcframework' end # Optional subspecs # FeatureA capability s.subspec 'SomeFunctionality' do |ss| ss.source_files = 'FeatureA/SomeFunctionality/**/*.{swift, h}' ss.dependency 'FeatureA/Core' endend
There is no error when running pod spec lint
and pod lib lint
commands.
Is there something I'm missing for this setup to work with Cocoapods? Or is just something that is not supported?Thanks in advance!