Build Swift dynamic framework with third party static framework as a single framework

2018-06-22T19:51:29

Trying to prepare a single dynamic framework to my customer. My framework (A.framework) uses third-party recognition static framework (B.framework). I can't provide separate A and B frameworks to the customer. Ideally B.framework should be built and included into my A.framework's binary, so the customer's app will only embed A.framework without any additional actions to link with that third-party app.

What I did:

  1. Added B.framework to the project.
  2. Added B.framework to "Linked Frameworks and Libraries" in the corresponding target.
  3. Built A.framework.
  4. Created a demo application and included A.framework to the project.
  5. Added A.framework to "Embedded Binaries".
  6. Demo app's build fails with message "Missing required module 'B'" (despite the fact that it is used in A.framework only).

Note:

  • I neither created any modulemap files for B.framework, nor additional run scripts
  • Making A.framework static is not acceptable because it includes some resources (storyboards, icons and some other files)
  • Tried to make un-recommended "umbrella" framework but got stuck on loading B.framework's bundle in demo app
  • Tried to make fake "umbrella" framework by simply copying B.framework inside A.framework, but got 2 problems - huge size of A.framework and Mach-O error while exporting the demo application (because of Mach-O difference between dynamic A and static B frameworks)

Any ideas would be highly appreciated!

UPD 1: This is not about umbrella framework because the proper umbrella framework implementation requires to load sub-framework from bundle which is not good. The fake framework implementation (sub-framework simply copied to umbrella) won't work for release because of different Mach-O values - dynamic and static. Plus fake umbrella framework has a huge size because sub-framework is being fully copied inside umbrella.

UPD 2: Created a small test project: StaticFrameworkTest which has 3 sub-projects:

  1. Demo-application with dynamic framework dependency (framework A) and shouldn't know anything about framework B
  2. Dynamic framework with static framework dependency (framework B) which ideally should be included in A framework's binary.
  3. Static framework B

Copyright License:
Author:「semenchikus」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/50987331/build-swift-dynamic-framework-with-third-party-static-framework-as-a-single-fram

About “Build Swift dynamic framework with third party static framework as a single framework” questions

Trying to prepare a single dynamic framework to my customer. My framework (A.framework) uses third-party recognition static framework (B.framework). I can't provide separate A and B frameworks to the
This is just an informational question, I have been examining several ways to make frameworks in iOS. I made Swift Pure frameworks:- There I got to know that, you have to include the xcodeproject...
Now I have a project, like testApp, using some third party lib like alamofire and some others libs in objective-c. Now I want to add a today widget. According to some tutorial, I created a new tar...
I am trying to build a static library which is using a third party framework. It is built successfully. But, the problem is, when i am including my static library into any sample application, the
I'm developing a Cocoa Touch Framework which is used a couple of third-party static libraries and frameworks. For some of them I have a source code. For others I'm don't. The issue is when someone ...
I am trying to build a Cocoa Touch Framework written in Swift language. There are cases where we need to use third party frameworks. What I'd like to do is package an iOS framework (could be a Sw...
My team is developing a ios framework for third party companies using swift. In order to adapt swift pattern, we decided to using simple naming class and encapsulate them into several modules (in t...
I need to use a third party lib or framework in my framework with Objective C, and I need to dynamically import this third party framework. My situation is like below: My framework is used for
As i understand the big change from ios dynamic framework and static is that static is linked statically to the code at link time (prior to launch) and dynamic is linked at launch/runtime Now i ha...
I am creating custom dynamic framework in pure swift lang which is using a pre-compiled iOS Realm framework (downloaded from their website). I have tried various options to use this framework in an

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.