Advertisement
redribben

singleton difference

Nov 21st, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. + (BMHttpAudioStreamManager*) getInstance {
  2.     if (singletonInstance == nil) {
  3.         singletonInstance = [[super alloc] init];
  4.     }
  5.     return singletonInstance;
  6. }
  7.  
  8.  
  9. + (instancetype)sharedGameData {
  10.     static id sharedInstance = nil;
  11.     static dispatch_once_t onceToken;
  12.     dispatch_once(&onceToken, ^{
  13.         sharedInstance = [[self alloc] init];
  14.     });
  15.     return sharedInstance;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement