title: Block with multiple parameters as argument in swift/objective-c
body: <p>I'm trying to pass a Swift function (with multiple parameters, defined as a closure) to an Objective-C function. Technically, the function is defined in Objective-C++, but I'm encountering an issue at the header level, so it should be equivalent for this question.</p>
  
  <p>In the Objective-C header, I have this defined as:</p>
  
  <pre><code>@interface MyObjCClass : NSObject
  typedef void (^MyCallback)(NSMutableData*, int);
  
  - (void) functionThatTakesACallback: (MyCallback) callback;
  </code></pre>
  
  <p>In swift, I'm trying to use it in this way:</p>
  
  <pre><code>self.objcclass!.functionThatTakesACallback()
  {
      (values: NSMutableData, length: Int32) -&gt; Void in
          // Do something with this data.
  }
  </code></pre>
  
  <p>The error I get is: </p>
  
  <blockquote>
    <p>Cannot convert value of type <code>'(NSMutableData, Int32) -&gt; Void'</code> to expected argument type <code>'MyCallback!'</code></p>
  </blockquote>
  
  <p>If I unwrap that a bit, by putting the block directly into the Objective-C function definition (sans typedef):</p>
  
  <pre><code>- (void) functionThatTakesACallback: (void (^)(NSMutableData*, int)) callback;
  </code></pre>
  
  <p>it gives me the vaguely more helpful: </p>
  
  <blockquote>
    <p>Cannot convert value of type <code>'(NSMutableData, Int32) -&gt; Void'</code> to expected argument type <code>'((NSMutableData!, Int32) -&gt; Void)!'</code></p>
  </blockquote>
  
  <p>So, essentially, is there any way to unwrap this closure to fit the expected type? Or redefine the Objective-C type?</p>