-1

We have two released applications. They have many duplicated objective c class and categories. I need to move all code from application B to A. But we do not have namespace in objective c. So I had to rename class in application B and modify related codes. And it take very very long time to do the rename things.

Do you known any possible method to reduce the time for it? Or maybe we do not need to rename the duplicated class and use anything like namespace.

Cristik
  • 30,989
  • 25
  • 91
  • 127
Laurence Fan
  • 1,074
  • 1
  • 11
  • 15
  • Does this answer your question? [Duplicate class names in different libraries](https://stackoverflow.com/questions/5508169/duplicate-class-names-in-different-libraries) – lazarevzubov Oct 24 '22 at 04:48
  • Other similar questions: https://stackoverflow.com/questions/178434/what-is-the-best-way-to-solve-an-objective-c-namespace-collision, https://stackoverflow.com/questions/25310154/same-class-names-on-different-libraries – lazarevzubov Oct 24 '22 at 04:49
  • 1
    @lazarevzubov Thank you for your help. I think currently objective c does not support namespace. I will read the questions carefully later. – Laurence Fan Oct 24 '22 at 08:51

1 Answers1

0

No, Objective-C does not support name spaces. This is why people insert a short prefix to each class/symbol name, like all the NS* and UI* classes from Apple. This was a deliberate design decision back when Objective-C was designed, IIRC.

Your situation sounds like you might want to introduce a framework shared by both apps and provide versions of your classes that can be used by both apps to avoid code duplication.

DarkDust
  • 90,870
  • 19
  • 190
  • 224
  • Thank you for your explanation. I have to rename and add different prefix for the duplicated classes. It took me much time and it is very painful. Thank you again for your answer. – Laurence Fan Oct 24 '22 at 08:53