Hi Team,
We need to distribute custom SDK in iOS. As our deplyoment target is iOS 8 onwards, we preferred to distribute in the form of framework.
We also have plans to use the same SDK for our own Apps published in app Store.
But there are coutner arguments as listed below:
1. As this as framework is bundled with each app and sandboxing will not allow to share this framework across the apps, it will unnecessorly increase the disk size of app and we dont get benifit of dynamic sharing as in case of OS X.
2. Static library will reduce the app size.
I went through Building Modern Frameworks for iOS and it mentioned that it is useful to have frameworks if multple apps uses frameworks ( we already have our own 3 apps that could use our frameowrk). I understand its useful in case of app and its extension.
My question is with the App sandboaxing in place (each app having framework in its bundle), how it make sense to have frameworks.
Suppose we have App1 and App2 having our framework (code signed), then will iOS take care of maintianing a single copy of framewok in the disk? (assuming both are using same set of interfaces and versions)
Is there a option to publish this framework as a shared API service?
Thanks in advance.
Thanks and regards
Vani
>> Is it not true in case of static library too?
Static libraries also acheive code modularity when shared across multiple app targets, yes.
>> If app extension in not in scope, then should we prefer static library as app using it would have lesser disk image as compared to frameworks.
It depends on your needs. Frameworks are nice because they wrap up any resources the framework depends on, simplying integrating them into apps. Within a single app that might have multiple binaries (an app executable and several app extensions), frameworks can reduce the size of an app, because common code is represented once, in a framework, instead of in each binary, as would be the case for a static library. However, if you have a lot of frameworks, the cost to the launch time of an app can be significant. Discussion of these costs is covered in the WWDC 2016 Optimizing App Start Up Timepresentation.
>> I mean at run time, two Apps using the same custom framework (with same version) will load their own copies of framework or they share the same copy?
Each app loads their own copy of the framework.