kanghua
5/23/2017 - 3:32 AM

Singleton

Singleton

class SingletonA {
    
    static let sharedInstance = SingletonA()
    
    init() {
        println("AAA");
    }
    
}
+ (AppManager *)sharedManager
{
    static AppManager *defManager = nil;
    static dispatch_once_t oncePredicate;
    dispatch_once(&oncePredicate, ^(){
        defManager = [[AppManager alloc] init];
    });
    return defManager;
}