redribben icon

singleton difference

redribben | PRO | 11/21/15 07:29:21 PM UTC | 0 ⭐ | 7432 👁️ | Never ⏰ | []
Objective C |

0 B

|

None

|

0 👍

/

0 👎

+ (BMHttpAudioStreamManager*) getInstance {
    if (singletonInstance == nil) {
        singletonInstance = [[super alloc] init];
    }
    return singletonInstance;
}
 
 
+ (instancetype)sharedGameData {
    static id sharedInstance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedInstance = [[self alloc] init];
    });
    return sharedInstance;
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎