I want to build a Cocoa touch framework in iOS. My framework named as 'MyFramework' which depends on third party frameworks like 'GoogleWebRTC'.
I tried adding this through cocoa pods and also with drag into MyFramework project. But the issue is when I import MyFramework into any other Project, it gives error:
Module 'WebRTC' not found
I have also seen that Apple discourage umbrella frameworks:
Why are umbrella frameworks discouraged?
Then:
I want to understand how I can include this GoogleWebRTC.framework or any other third party lib. in MyFramework project and distribute to others.
Help is Appreciated!
Solution for me was that I have to explicitly add GoogleWebRTC in the app with my framework.
And if your framework can install by pods then you can mention your dependent third parties lib. in podspec file as below:
s.ios.dependency 'dependent framework pod'
Related
I've built swift frameworks before, but I've never dealt with one that has 3rd party dependencies.
What I have right now is a Swift framework that has a dependency on several Swift packages. When I build it I see MyFramework.framework in the products folder as well as bunch of dependencies. I can make XCFramework out of it, but when integrating (embedding) it into another app I see an error that MyFramework is missing its dependencies (see image below).
What am I doing wrong or missing?
Creating a framework (or xcframework) that has embedded other frameworks is not supported for iOS(I believe this is answered here).
But there is an other way. You can statically link all the dependencies of your library, so in the final framework the binary will also contain the code of its dependencies.
If you are using CocoaPods and the name of the framework is aFramework you can do:
target 'aFramework' do
pod 'Alamofire', :linkage => :static
end
Then you can use the created aFramework.framework in a application target that does not have the Alamofire framework, since the code will be "embedded" in the aFramework's binary.
I have the custom created framework.
I want to use CryptoSwift Pods in this framework.
First, I create a custom framework and I can use this framework(From Frameworks folder Example.framework) from another project.
Second, I installed CryptySwift Pods to these frameworks
How can I install Pods programmatically in custom frameworks and used it in other projects?
Not understanding you exact question but if you want to create your own framework and you are using any third party then you can create your framework with your own files and then when you will use your framework in another project then ask developer to install those third party pods or frameworks into their project. It will help to avoid conflict if developer also using same framework or pod in their project.
I have written a framework that make use of SAMKeychain. This frameworkA is used inside the an iOS project.
The iOS project in return has some additional classes that uses the same SAMKeychain. I am trying to find a way to refer the SAMKeychain in the framework and include as a dependency(But do not include SAMKeychain sources) inside the framework.
I tried referencing just the header files of SAMKeychain in the framework and try to build the framework but It failed with linking error _OBJC_CLASS_$_SAMKeychain
What is the best way to share third party code between the framework and iOS project
The solution was to use dynamic frameworks . So when frameworkA is made it should be dynamic and the Pods it contains that is SAMKeychain should also be dynamic to do that you use
use_frameworks! in Podfile which will create SAMkeychain.framework for the Pod SAMkeychain.
After the frameworkA binary is created in the iOS project you have to add both frameworkA and SAMKeychain.framework as embedded binaries. And this will work just ok.
Note that if you don't use use_frameworks in the Podfile it would generate a static library of the pod which will be included in the binary of frameworkA.
Hope this helps someone!
I created a cocoa touch framework with Swift as the preferred language.
On this framework I need to import static libraries, so I created a podfile and imported the pod using use_frameworks!
I created a bridging header and also added the pods source as header search path since it couldn't find the pod's header.
The framework compiles fine and I have no issues.
So I created a pod spec for the framework and created a sample app in swift. I had the framework as development pod in my podfile. Now I get
Include of non-modular header inside framework module in my bridging header import of the static library public header.
I understand since it's a static library we cannot build the touch framework, but what would be the work around to have a touch framework with static libraries in them written in Swift.
PS I have set Allow Non-modular Includes in Framework Modules to Yes
To answer my original question. It seems to be an issue with cocoapods(0.36.2) for vendor libraries where there is no implementation file.
There is a hack to get this working and you can take a look at this github issue
I'm trying to create a Cocoa Touch Framework. To create a framework is not a problem, I used this tutorial and it is good.
I need to use third party libraries inside: like openssl, XLForm, AFNetworking. I know that it is not correct to include them in my framework, I need to create a dependencies, but I can't find how to do this.
Moreover is it possible to use pods in my framework and just make dependencies to these libs. So user which will include my framework to his project will need just install these pods.
It seems that I found solution.
Thanks to #Droppy and thanks to this question.
What I did: I just installed pods to my Framework project but used this use_frameworks! key.
Then I dragged my Framework to my Project and installed pods there, also with same key, otherwise (when pod wasn't installed in my Project) I was getting error like:
dyld: Library not loaded: #rpath/XLForm.framework/XLForm...
I used XLForm inside my Framework.