Greetings,
I'm looking at Matt Gallagher's macro for creating singleton classes. http://cocoawithlove.com/2008/11/singletons-appdelegates-and-top-level.html
Basically, I have an app with multiple views and I want to be able to access "global" data from each of these views using a singleton class.
I basically have three strings I want to access in this class: NSString *uname, NSString *details and NSString *selectedDetails.
Do I need to make three singleton classes with a static variable in each?
Also, how do I get and set the string variables uname, details and selectedDetails?
I'm a bit mixed up with all this singleton stuff (I only encountered such things today!) and I was wondering if anyone could point me in the right direction.
Many thanks in advance,
Here is some code I've done:
#import <Foundation/Foundation.h>
@interface Details : NSObject{
}
+(XXX *)sharedXXX;
@end
#import "Details.h"
#import "SynthesizeSingleton.h"
@implementation Details
SYNTHESIZE_SINGLETON_FOR_CLASS(XXX);
@end