title: Objective-C singleton GCD - [self alloc] or [Class alloc]
body: <p>I was looking at modern patterns of Objective-C to create singletons after the introduction of <code>instance</code> </p>
  
  <p>from: <a href="https://stackoverflow.com/questions/5720029/create-singleton-using-gcds-dispatch-once-in-objective-c">Create singleton using GCD&#39;s dispatch_once in Objective C</a></p>
  
  <pre><code>+ (instancetype)sharedInstance
  {
      static dispatch_once_t once;
      static id sharedInstance;
  
      dispatch_once(&amp;once, ^
      {
          sharedInstance = [self new];
      });
  
      return sharedInstance;
  }
  </code></pre>
  
  <p>And I was wondering why not use [MyFunnyClass new] as below?</p>
  
  <pre><code>@implementation MyFunnyClass
  + (instancetype)sharedInstance
  {
      static dispatch_once_t once;
      static id sharedInstance;
  
      dispatch_once(&amp;once, ^
      {
          sharedInstance = [MyFunnyClass new];
      });
  
      return sharedInstance;
  }
  </code></pre>
  
  <p>Or if it's the same?</p>
  
  <p>(Ref: <a href="http://nshipster.com/instancetype/" rel="nofollow noreferrer">http://nshipster.com/instancetype/</a>)</p>
  
  <p>Edit: the answers given at <a href="https://stackoverflow.com/questions/3559763/why-use-classname-alloc-instead-of-self-class-alloc">Why use [ClassName alloc] instead of [[self class] alloc]?</a> are not related to this question</p>