I have a Singleton set up like this:
static Universe *instance;
+ (Universe *)instance { return instance; }
+ (void)initialize
{
static BOOL initialized = NO;
if(!initialized)
{
initialized = YES;
instance = [[Universe alloc] init];
}
}
- (id) init
{
self = [super init];
if (self != nil) {
self.showHistory = YES;
}
return self;
}
but now I realize that I'd like to instantiate it from Interface Builder. I was thinking of just cutting into the init
method like so
if (instance)
return instance;
is this a bad idea? I'd prefer IB to pick up the instance already created in the +initialize
method.