In Objective-C, you usually prefix your class with your initial.
For example, I would declare my Box class like JABox.
Because it becomes 2nd nature to Mac programmers, we usually don’t have symbol conflict problem.
However, if you are really really unlucky, you can use two separated 3rd party libraries or framework with same class name, structure, and so on. Unlike C++, Objective-C doesn’t provide namespace.
( Personally I don’t see usefulness of namespace in Objective-C. Philosophy is different between C++ and Objective-C. C++ is like “all the tools you need to have”, while Objective-C is “not to introduce more complexity than necessary. Make things simple. If it is not essential, don’t add any facility to Objective-C.” )
However, if you really really really need to solve symbol conflict, what should you do?
Today I found some explanation on the subject.
- What is the best way to solve an Objective-C namespace collision?
- Alternatives to Prefixing
- Compatibility Alias
The point is to use @compatibility_alias. Loading each framework dynamically and unloading can’t be applied to any library and very un-handy.