title: How to create generic closures in Swift
body: <p>I would like to create a function that uses generic closure (block) in swift.</p>
  
  <p>My first attempt was to do like :</p>
  
  <pre><code>func saveWithCompletionObject(obj : AnyObject, success : AnyObject -&gt; Void, failure : Void -&gt; Void)
  </code></pre>
  
  <p>But as soon as I call this function with another block, such as :</p>
  
  <pre><code>func doSomething(success : String -&gt; Void, failure : Void -&gt; Void)
  {
      saveWithCompletionObject("Example", success, failure)
  }
  </code></pre>
  
  <p>I get an error : <code>'AnyObject' is not a subtype of 'String'</code></p>
  
  <p>Thanks in advance !</p>