title: Create singleton using GCD's dispatch_once in Objective-C
body: <p>If you can target iOS 4.0 or above</p>
  
  <p>Using GCD, is it the best way to create singleton in Objective-C (thread safe)?</p>
  
  <pre><code>+ (instancetype)sharedInstance
  {
      static dispatch_once_t once;
      static id sharedInstance;
      dispatch_once(&amp;once, ^{
          sharedInstance = [[self alloc] init];
      });
      return sharedInstance;
  }
  </code></pre>