One of the things i (still) have trouble getting into the back of my head is public/private methods, parameters and how it works compared to the Java world i have been living in for a long time.
I have started using the notificationcenter since a while back, and i noticed that you can declare a method within your implementation file (.m) and use that as a selector when registering your observer in the nsnotificationcenter
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(aMethodNotDefinedInTheHeaderFile:) name:NOTIFICATION_KEY object:nil];
So, my question is - what is best practice here? Should i still define the method in my header file, and to what end?
Pointers much appreciated.
Declaring methods in header files is used to get users of the class overview of a methods which they can use.
As soon as subscribing for a notification is usually an internal thing (you subscribe and receive notification in the same class), I'd say it's not needed.
However, if the method is a part of API, which can be used elsewhere, you'd probably want to put it in .h file.