I’ve been setting up my method prototype in the class file, instead of the header file. I’m not sure if it really makes a difference, should I be using the header files.
Are there disadvantages or advantages to setting the prototypes this way?
#import "SettingsViewController.h"
@interface SettingsViewController()
- (void)syncSettings;
@end
@implementation SettingsViewController
- (void)syncSettings
{
// Code Here
}
// Other Methods
@end
Anything you restrict to the .m won’t be visible to other .m files. So as a general rule, it’s advantageous to put into your .h only the interface features that you intend to publish — don’t put methods that you intend to keep private in there and don’t put instance variables in there.
There are no disadvantages to keeping implementation details above and beyond the public interface unpublished.