I have a simple NSObject which I'm using a Singleton within:
.h file:
#import <Foundation/Foundation.h>
@interface FooAPIClient : NSObject
+ (FooAPIClient *) sharedInstance;
@end
and my .m file:
#import "FooAPIClient.h"
@implementation FooAPIClient
+ (FooAPIClient *) sharedInstance {
static FooAPIClient *_sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedInstance = [[FooAPIClient alloc] init];
});
return _sharedInstance;
}
@end
I'm trying to work out where I can put my properties, ie. @property(nonatomic, strong) NSString *bar;
without putting them in my header file. If I copy @interface
into my .m file, it complains that I'm duplicating my definition.
Could do with a couple of pointers on where to declare internal (to the Class) properties?