title: Swift: Asynchronous callback
body: <p>How do I make asynchronous callbacks in swift? I'm writing a little Framework for my app because it's supposed to run on both, iOS und OS X. So I put the main code that is not device-specific into this framework that also handles requests to my online api. And obviously I also want the app's GUI and therefore my ViewControllers to react as soon as a api request has finished. In Objective-C I've done this by saving the view containing the function that had to be called in an id variable and the function itself in a selector variable. Then I invoked the function using the following code:</p>
  
  <pre><code>SEL selector = callbackMethod;
  ((void (*)(id, SEL))[callbackViewController methodForSelector:selector])(callbackViewController, selector);
  </code></pre>
  
  <p>How can I accomplish this in swift? Or is there a better way of doing this?</p>
  
  <p>I really appreciate all your help!</p>