Matrosov Alexander Matrosov Alexander - 3 months ago 38
iOS Question

Provide access to the private method that are defined in base class

I have found this explanation, but I think I am a little confused.

So as I understood if I use category in my BaseDataHandler.m:

@interface STDataHandler (STDataHandlerPrivateMethods)

- (void)syncDataWithServer:(NSDictionary *)params;


the method syncDataWithServer will not be found in the child for example

So my question is how I can provide this method for the child but hide for other classes. If I put this method to
it will be a public one.


Take that category definition for your interface and put it in a file called STDataHandler_private.h. Then import STDataHandler_private.h in your child class's .m file.

In theory some other class could import your "private" header and access that method too... so don't do that. ;)