Enabling garbage collection support.
[ITFoundation.git] / ITSharedController.m
1 #import "ITSharedController.h"
2
3 static NSMutableDictionary *_ITSharedController_sharedControllers = nil;
4
5 @implementation ITSharedController
6
7 + (id)sharedController {
8         if (!_ITSharedController_sharedControllers) {
9                 _ITSharedController_sharedControllers = [[NSMutableDictionary alloc] init];
10         }
11         id thisController;
12         if (thisController = [_ITSharedController_sharedControllers objectForKey:NSStringFromClass(self)]) {
13                 return thisController;
14         } else {
15                 thisController = [[self alloc] init];
16                 [_ITSharedController_sharedControllers setObject:thisController forKey:NSStringFromClass(self)];
17                 return thisController;
18         }
19 }
20
21 @end