Sometimes framework objects put helper class interfaces inside of *.m files, such as:
Foo.m:
@interface HelperObject : NSObject
/*...*/
@end
@implementation HelperObject
/*...*/
@end
@implementation Foo
/*...*/
@end
If I want to extend Foo, for instance using a category, is there a way to extend HelperObject as well? More generally, is doing so a violation of encapsulation? Should I try to extend the class functionality without extending HelperObject?
Callers of
Fooknow nothing aboutHelperObject–frequently, they do not even know it exists. So no, it’s not safe or valid to be subclassing it in another file.