title: How to implement the Singleton in Objective-C and make sure the user never creates more objects?
body: <p>I know that we can implement the Singleton pattern in Objective-C like this:</p>
  
  <pre><code>+ (instancetype)sharedInstance
  {
      static PPSettings *instance = nil;
      static dispatch_once_t onceToken;
  
      dispatch_once(&amp;onceToken, ^{
          instance = [[self alloc] init];
      });
  
      return instance;
  }
  </code></pre>
  
  <p>However, how do I make sure users would never be able to create more objects like this:</p>
  
  <pre><code>PPSettings *settingsObj1 = [[PPSettings alloc] init];
  PPSettings *settingsObj2 = [[PPSettings alloc] init];
  </code></pre>
  
  <p>?</p>
  
  <p>In other words, how we can achieve the same idea as Private Constructors in Java or C#?</p>
  
  <p>Thanks in advance!</p>
  
  <p>P.S.</p>
  
  <p>Also, is it correct like:</p>
  
  <pre><code>instance = [[self alloc] init];
  </code></pre>
  
  <p>or better like this:</p>
  
  <pre><code>instance = [[[self class] alloc] init];
  </code></pre>