title: Swift: getting AppDelegate instance as a class func results in Thread 1: EXC_BAD_INSTRUCTION
body: <p>I want to get my AppDelegate reference from a <code>class func</code> in my <code>AppDelegate</code>. Why is this throwing a <code>Thread 1: EXC_BAD_INSTRUCTION</code>?</p>
  
  <pre><code>class func getDelegate() -&gt; AppDelegate {
      return UIApplication.sharedApplication().delegate as! AppDelegate
  }
  </code></pre>
  
  <p>I have also tried to move this to another utility class and as a regular <code>func</code>, but getting the same crash.</p>
  
  <p>Is there a way I can access the <code>AppDelegate</code> as a <code>class func</code> instead of having to write </p>
  
  <pre><code>let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
  </code></pre>
  
  <p>in every class?</p>