title: Objective C - Category to modify a singleton object?
body: <p>I know that the whole point of singleton is to instantiate 1 instance of the onject and reuse it, but when it comes to unit testing I want to be able to renew the singleton object before every test.</p>
  
  <p>I tried to use a category to access the singleton object and release it but It's not accessible by categories any idea what's the best way to achieve this?</p>
  
  <pre><code>@implementation SingletonClass
  
  static SingletonClass *singleton;
  
  + (SingletonClass*)sharedInstance
  {
     if (!singleton)
     {
        singleton = [[SingletonClass alloc] init];
     }
     return singleton;
  }
  
  @end
  </code></pre>
  
  <p>.</p>
  
  <pre><code>@implementation SingletonClass(Unit Testing Additions)
  
  + (void)killInstance
  {
     // I get an error here and I cannot access the singleton Object
     [singleton release], singleton = nil;
  }
  
  @end
  </code></pre>