I've a SDK in Swift 5.1 which our customer would like to distribute (sell) as a compiled SDK instead of giving its sources.
Unfortunately this SDK depends on some third party libraries, integrated using CocoaPods (Alamofire, RealmSwift, ReachabilitySwift, etc...). I know you should avoid having third party dependencies in your frameworks/libraries, but unfortunately we started working on this project after another agency started it. This SDK is actually a cocoapod's Pod, but it's not a compiled pod.
What is the best approach in order to distribute this SDK as a compiled SDK (in order to avoid giving source files to the final consumers who'll buy it) ?
As far as i've understood, if you compile your sdk with third party dependency, you must be sure the app that will use the same libraries with the same public apis as the one used by the compiled sdk, otherwise the app will crash at runtime. The only way to do so, as far as I understand, is to specify a very strict version of each third party dependency in the compiled sdk podspec. For example, Alamofire, '~> 4.2.0'. But I don't like this approach because this way the app can't use a newer version of Alamofire (or the other dependencies), only because the compiled sdk has been compiled with that version.
I'm creating an XCFramework, then a podspec with that XCFramework vendored as vendored_framework (using CocoaPods 1.9.0-beta2 which is the only one that currently supports XCFrameworks as vendored_framework).
I tried many different approaches, like trying to build the compiled sdk as static libraries and linking it's third party dependencies as static libraries too, but in this case when using it in the app, along with the same dependencies (e.g. Alamofire), i see in the console some "Class X is implemented in both Y and Z. Which one to use is undefined" (where Y and Z are the sdk and the app).
Have you any suggestion? How would you do that ?
Thank you!