首页 > 技术文章 > 创建单例类

Zsmile 2018-01-30 10:13 原文

+ (MYManager *)shareManager {
    static dispatch_once_t once;
    static MYManager * __singleton__;
    dispatch_once(&once, ^{
        __singleton__ = [[MYManager alloc] init];
    });
    return __singleton__;
}

 

推荐阅读