DOSingleton
DOSingleton copied to clipboard
self.isInitialized is set to YES after [super init] in subclasses
Now you could check if your singleton subclass has already been initialized by checking isInitialized before calling [super init] because DOSingleton will set this property to YES in its init method and your initialization never calls (if you follow convention).
Need some other method to check if singleton has been initialized in subclasses.
+1
+1
I've updated the docs.
So for now you could check where the instance is initialized before calling [super init] like this:
- (id)init
{
if (!self.isInitialized) {
self = [super init];
if (self) {
// Initialize self.
}
}
return self;
}
Still looking for a better solution..