Use Objective-C blocks in swift
<p>I have a third party Objective-C library in my swift project, in one of the .h files, it has a <code>typedef</code>:</p>

<p><code>typedef void (^YDBlutoothToolContectedList) (NSArray *);</code></p>

<p>and inside the class, it has a property:</p>

<p><code>@property (nonatomic, copy) YDBlutoothToolContectedList blutoothToolContectedList;</code></p>

<p>(please ignore its spelling)</p>

<p>When I try to use this property in my swift class, I use</p>

<pre><code>bt.blutoothToolContectedList = {(_ tempArray: [Any]) -&gt; Void in
    self.devices = tempArray
    self.tableView.reloadData()
}
</code></pre>

<p>and I got the error says:</p>

<p><code>Cannot assign value of type '([Any]) -&gt; Void' to type 'YDBlutoothToolContectedList!'</code></p>

<p>I know the above Objective-C code in swift would be:</p>

<p><code>typealias YDBlutoothToolContectedList = () -&gt; Void</code></p>

<p>but I can't re-write that Objective-C file and swift can't cast the closure type, is there a possible way to solve this problem?</p>