Hi,
I am looking at a Matt Gallagher macro to create singleton classes. http://cocoawithlove.com/2008/11/singletons-appdelegates-and-top-level.html
Basically, I have an application with several views, and I want to have access to the “global” data from each of these views using a singleton class.
I basically have three lines that I want to get in this class: NSString * uname, NSString * details and NSString * selectedDetails.
Do I need to create three singleton classes with a static variable in each?
Also, how do I get and set the string variables uname, details and selectedDetails?
I got a little mixed up with all this singleton stuff (today I met only with such things!), And I was wondering if anyone could point me in the right direction.
Thank you very much in advance,
Here is the code I made:
#import <Foundation/Foundation.h>
@interface Details : NSObject{
}
+(XXX *)sharedXXX;
@end
#import "Details.h"
#import "SynthesizeSingleton.h"
@implementation Details
SYNTHESIZE_SINGLETON_FOR_CLASS(XXX);
@end
source
share