I am trying to declare a private @interface for a category in a .m file.
For a normal class, I would do:
@interface ClassA () @end @implementation ClassA @end
and it will work smoothly.
For a class with categories I tried:
@interface ClassA (CategoryA) () @end @implementation ClassA (CategoryA) @end
but he gives all kinds of mistakes. I am trying to "expand" a category, a way to extend a class through this @interface ClassA () syntax.
I want to have private methods for this category, and I would like to know if in INDITION to the open interface I can put the second @interface category in a .m file that does not expose instance variables and methods outside the class itself.
Something like that:
ClassA + categoryA.h
@interface ClassA (CategoryA) <some public methods> @end
ClassA + categoryA.m File
@interface ClassA (CategoryA) <some private methods> @end @implementation ClassA (CategoryA) <here I want to be able to call the private methods above> @end
This now gives me a warning in Xcode:
Duplicate definition of category 'CategoryA' on interface 'ClassA'
Is there any way to get this behavior?
Fabrizio prosperi
source share