[Objective-C] How to use GDC for create a singleton class
      back

+ (id)sharedInstance
{
    static dispatch_once_t once;
    static id instance;
    dispatch_once(&once, ^{
        instance = self.new;
    });
    return instance;
}






Copyright © 1996-2020 Centro Studi Informatica di Danilo Priore. All rights reserved. P.I.10149810581.