title: What happens if the init method of a singleton class is called before the +sharedInstance method..?
body: <p>What happens if the init method of a singleton class is called before the +sharedInstance method..? Will this result in a new object and if not then how the same instance is returned ? The fact that the static variable is declared inside the sharedInstance will have any effect on the overall outcome..?</p>
  
  <pre><code>+ (LibraryAPI*)sharedInstance
  {
      // 1
      static LibraryAPI *_sharedInstance = nil;
  
      // 2
      static dispatch_once_t oncePredicate;
  
      // 3
      dispatch_once(&amp;oncePredicate, ^{
          _sharedInstance = [[LibraryAPI alloc] init];
      });
      return _sharedInstance;
  }
  </code></pre>