I would create a separate header file with a category. You could name that category Protected
:
@interface MyClass(Protected)
// Place your "protected" methods here.
@end
Normal class users would not #import
this file, only the main class file. But the implementation and subclasses would the also #import
the header file containing the Protected
category.
If the methods are optional, you could instead make use of a protocol:
@protocol MyClassProtected
// Required methods here.
@optional
// Optional methods here.
@end
I feel that this not as good a solution as the category but it'd work.
Then, the third way is to simply refrain to convention: name your protected methods accordingly:
@interface MyClass {
}
// This method is not to be called by users, but subclasses may
// overwrite to do something else.
- (void) protected_someMethodDoingFoo;
@end