compiling compiling/bundling an external framework to my static library/framework for iOS SDK - iphone

im trying to build a framework that uses methods from a 3rd party framework.
I would like to hide the methods 3rd party framework from being accessible by the user of my framework.
I tried compiling using static library method and framework method.. but the 3rd party framework doesn't seems to be included in my framework..
any one know how can i bundle the 3rd party framework in my library file?
any help is much much appreciated.

It's not possible to include a static library or another framework inside an home-made framework. The user will need to add both your framework and a static library (3rd party methods) in its project to be able to use it.

There is nothing wrong in having a dependency in your static library / custom framework. Simply inform the user about it and, if possible, bundle the depended library in your distribution.
ObjectiveC does not allow the usage of namespaces, hence there is no way to "hide" the methods of a static library effectively.

Related

Third-party frameworks embedded into .xcframework

I would like to use RxSwift inside my .xcframwork, is there any 'good practice' to add third-party frameworks to your .xcframework to be able to ship it 'all in one' for the customer?
I was trying to generate RxSwift.framework from their github repo, and add it to the framework itself, but didn't work at the end, while using with Example app have this error:
Any link or idea would be welcome :)
Finally I decided to add RxSwift as a package to my Framework and then expose RxSwift agnostic interface of the Framework for the customer, so they will be not aware that Im using under the hood Rx. I had to mark all RxSwift imports as #_implementationOnly import RxSwift.
Another benefit of this is that customer of my Framework is not forced to have a knowledge about RxSwift since Im using vanilla Swift (closures).

Creating an assembly from Xamarin (or Module), then importing it into Swift?

That would be the million dollar question! Is it possible to create an assembly in Xamarin (C#) for IOS, then import that into a Swift project?
I am getting really into Swift and I know there are some major things that I am still missing such as the ease of calling a web service, etc... So what I want to do is create a web service call in a Xamarin Assembly (or module) and use the Imports into Swift to import and reference my assembly.
Sorry, no. It's designed to consume iOS libraries and you can create bindings to use them.......but not the other way around.
Either use Swift or Xamarin. If Xamarin you could create libraries in Swift and consume in Xamarin (but why would you if it wasn't a 3rd party library).....but you can't create libraries in Xamarin to consume in Swift.
If connecting to a web service is your only hurdle with Swift then that's probably not a good single reason to switch to Xamarin.

Include an iOS Framework into another one

The problem is that when I create a framework for iOS, that uses a different framework, I have to also include the second framework in my application.
What I want to try is to compile the second framework into the new one that uses it. so it's all one package. Is this even possible?
If so, how?
It's possible but strongly recommended against. If two frameworks both include another framework in this manner, you wouldn't be able to use both in the same project as the symbols would conflict. https://stackoverflow.com/a/14197817/72176
If the second framework is licensed in a way that it can't be given away separately with your framework, I'd be very surprised if you were permitted to distribute it as part of your framework either.

Use iOS Framework with ASIHTTPRequest integrated in project with ASIHTTPRequest

I created framework, that uses ASIHTTPRequest.
Than i added this framework into my project that already uses ASIHTTPRequest. And i got
ld: duplicate symbol ...
What is the correct way in this situation?
objective C has no namespace support it will guess which class to use with undetermined results.
On the other hand, you should not be exposing internal headers from your framework, not sure if that is the cause.
Either way, you have to pick one option or rename all your private ASIHttpRequest classes to avoid the conflict.
If you know the dependency is available then just use it from a dependent framework. This is just a build problem not a deal killer in most cases.

iPhone static libraries

I have some problems with creating static libraries.
Let say I have the static library A which I created and I included that to static library B with the relevant header files. I need to create a static library C which will be my final library and it it should include static library B which implicitly include the static library A. So I need to hide both implementation details of library A and B in the library C but it should not visible to the end user. Only an interface will be provided.
1) So let say my static library A uses some dependencies which are some libraries in the SDK. So do I need to import in my final project although I included the library C?
At the moment I am having some build issues when I tried above.
2) Can we bundle 3rd party static libraries inside our static libraries and distribute only our library?
3) Let say we are downloading some 3rd party code. Using that we are creating static libraries. Can we distribute a static library using 3rd party code. If so do we need to expose the code?
4) How does the static library acceptance in App store. Is it like the normal process? (I mean projects bundles with static libraries)
Thank you,
Regards,
Dilshan
Wow. Four questions. If only I could get 4x the rep. :)
Yes, you need to include the frameworks in the App's project. Linking a framework in a static library only creates references to symbols that don't exist. These need to be resolved during app link by linking in the frameworks to the final app.
I take it you're thinking about selling an SDK of static lib files and header files. Yes, it is technically possible to link it all into one giant library (see ar(5) for details) and ship the library and select header files, but see answer #3.
Depends on the license for the third-party library. Consult legal counsel if you have questions.
Most apps have a static library linked in to the app. For example, the vast majority of free apps include AdMob or similar advertising packages, which are distributed as a static library. A static library doesn't, per se, violate any Apple submission policy, but the library can violate a policy, such as including undocumented APIs. If the static library violates a submission policy, an app that uses it will be rejected, even if the app doesn't use that feature.
Incidentally, you can't completely "hide" the interfaces of library A and B (from your example.) If you could, Apple would and it would not be possible to use undocumented APIs. All you can really do is leave them out of the headers and documentation.