Last active
June 29, 2016 05:40
-
-
Save icanswiftabit/4737683 to your computer and use it in GitHub Desktop.
Singleton
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface LayerManager : NSObject | |
+ (id)sharedManager; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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