Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have 2 objective C class with same name in a same project? [duplicate]

Possible Duplicate:
What is the best way to solve an Objective-C namespace collision?

I was using 2 open source projects in an application with different use --- the issue was that both project had same class name with different implementations.

As per my understanding objective C don't have namespace option to handle scope --- as of now I am renaming the one of the class and its usage to make it work in my project.

Is there any alternative solution then renaming? I feel like objective C is missing namespace.

like image 291
Girish Kolari Avatar asked Nov 21 '25 22:11

Girish Kolari


1 Answers

Renaming is the correct way. There is a reason why Apple recommends to prefix your classes with some uppercase letters. This should prevent exactly this situation. Same for method names in class extension, or "private" methods.

like image 140
Eiko Avatar answered Nov 23 '25 14:11

Eiko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!