I have two methods -a and -b.
-a calls sometimes -b, and -b sometimes calls -a. Both methods are intended to be private, and not called from outside.
But I had to make one of them public in the .h file, because otherwise the compiler would go crazy and give a warning for either one of them.
Is there any valid and good-practise solution for that problem?
Traditionally, what you’d do is define a category (something like
@interface MyClass (MyClass_Private)inside the implementation file that declares the private methods. Apple recently introduced a feature called a class extension that is intended for this exact case. It’s basically a specialization of a category, but the class has to implement the methods when it’s first defined. It looks like: