I read Objective–C can easily lead to name collisions due it’s nature, so it is a best–practice to prefix your code.
How do you solve this issue if your MyAwesomeApp iOS application which is using two external libraries FooLibrary and BarLibrary results name collisions, because internally also FooLibrary happens to use BarLibrary?
At first one might suggest to remove either one of the references to BarLibrary, but you can’t do that, because although both are BarLibrary, they are actually two different versions of it, so FooLibrary depends on BarLibrary(v1) implementation whereas your MyAwesomeApp depends on BarLibrary(v2) implementation.
At this point I realized two distinct versions of the same library are two different things really and so they shouldn’t co–exist in the same project in the first place.
Is there any other way of solving this puzzle other than refactoring (by renaming things) someone else’s code please?
If the other library is using a library that is likely to be shared, e.g. a JSON library, and they are compiling a library for you to include, then they should really put their own prefixes on the library.
I’ve seen it done this way with Urban Airship, for example. They use JSONKit (or some JSON library), but they prefix all the JSONKit usages with UA – so that when I use a different version of JSONKit, they compile and run together.
I’ve also seen it done with Reachability … everyone seems to have their own version of this…