Skip to content

Instantly share code, notes, and snippets.

Last active Dec 16, 2015
What would you like to do?
@interface MyAwesomeSingletonPleaseDontNameMeThis: NSObject
+ (id)sharedInstance;
- (void)registerForNotifications;
@implementation MyAwesomeSingletonPleaseDontNameMeThis
+ (id)sharedInstance {
static id _sh;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sh = [[self alloc] init];
return _sh;
- (void)registerForNotifications {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
- (void)_applicationDidBecomeActive:(NSNotification *)notification {
// explode or whatever
%ctor {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[[MyAwesomeSingletonPleaseDontNameMeThis sharedInstance] registerForNotifications];
[pool drain];
Copy link

rmsy commented May 1, 2013

@interface MyAwesomeSingletonPleaseDontNameMeThis: NSObject

That's an interesting naming scheme...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment