I am currently working on an SDK that is available on the Android and iOS platforms.
For Android, we list the dependencies in our Gradle file and use Maven to provide the SDK (so our dependencies are listed in the .pom file).
For iOS, we use cocoapods to handle dependencies.
The problem is this: * Our SDK uses a dependency in version X * One of our clients can use the same dependency, but in version Y * Another client can also use the same dependency in version Z
Thus, this leads to the fact that our SDK can be split into one of our clients (if not both), because we guarantee that it works with dependency X, but not with Y and Z.
At this point, the legacy code simply imported the source code of the libraries causing this problem, and the names were put into it to simulate, we do not use the same library.
But, in my opinion, this is not an approximation solution: we do not have the latest corrections, it is painful to update, the client has two libraries instead of one.
So, at the moment I'm trying to think of a potential good solution, but I canโt find what I want on Google (maybe I donโt use the right keywords: /).
What I was thinking about was to provide support for a number of versions for each dependency. A bit like "if this method is here, execute it, otherwise use this method of the previous version" (for example, selector responseTo on iOS). Then, the client should be able to use any version of the dependency, provided that it is in the supported range.
However, I do not know if this is correct? Are there any other solutions?
Thanks:)