I am trying to declare a private @interface
for a category, in the .m file.
For a normal class I would do:
@interface ClassA ()
@end
@implementation ClassA
@end
and it would work smoothly.
For a class with categories I tried:
@interface ClassA (CategoryA) ()
@end
@implementation ClassA (CategoryA)
@end
but it is giving all sort of different errors. I am trying to "extend" a category, the way that a class is extended via this syntax @interface ClassA ()
.
I want to have private methods for the category, and I wanted to know if, IN ADDITION to the exposed interface I am allowed to put a second category @interface
in the .m file, which does not expose instance variables and methods outside the class itself.
Something like this:
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
Right now this is giving me a warning in Xcode:
Duplicate definition of category 'CategoryA' on interface 'ClassA'
Is there any way to get this behavior?