title: How to call a function on completion of an asynchronus request - Swift 2.0
body: <p>I have an asynchronus request in a class like this,</p>
  
  <pre><code>class Req{
      func processRequest(){
          NSURLConnection.sendAsynchronousRequest(request, queue: queue, completionHandler:{ (response: NSURLResponse!, data: NSData!, error: NSError!) -&gt; Void in
               //Do some operation here
          })
      }
  }
  </code></pre>
  
  <p>And I am calling this method from one view controller like this,</p>
  
  <pre><code>class classOne{
      func classOneFun(){
          Req().processRequest()
          self.demoFun()
      }
  
      func demoFun(){
          //Do some operation here
      }
  }
  </code></pre>
  
  <p>And I am calling the same function from another view controller like this,</p>
  
  <pre><code>class classTwo{
  
      func classTwoFun(){
          Req().processRequest()
          self.sampleFun()
      }
  
      func sampleFun(){
          //Do some operation here
      }
  }
  </code></pre>
  
  <p>Now I want to call the <code>demoFun()</code> or <code>sampleFun()</code> only after the <code>processRequest()</code> is completed. If <code>demoFun() or sampleFun()</code> and <code>processRequest()</code> are in the same class, then I can call the functions in the completion handler of processRequest(). But, in my case I cannot do that, since I have nearly 20 view controllers that call the processRequest() function. I cannot use SynchronusRequest as it is deprecated in Swift 2.0. So how can I call the other functions once the asynchronus request is completed?</p>