Skip to content

Instantly share code, notes, and snippets.

@icanswiftabit
Last active June 29, 2016 05:40
Show Gist options
  • Save icanswiftabit/4737683 to your computer and use it in GitHub Desktop.
Save icanswiftabit/4737683 to your computer and use it in GitHub Desktop.
Singleton
@interface LayerManager : NSObject
+ (id)sharedManager;
@implementation Singleton
+ (id)sharedManager {
static Singleton *sharedMyManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedMyManager = [[self alloc] init];
});
return sharedMyManager;
}
- (id)init {
if (self = [super init]) {
//inital value of prop
}
return self
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment