Swift: Cannot invoke 'filter' with an argument list of type '((AnyObject) throws -> Bool)'
<p>I'm trying to filter from a dictionary.</p>

<p>My code is below:</p>

<pre><code>var newSimHistoryArr = [] as NSArray
if self.filterBy == kPending {
    newSimHistoryArr = (dic["simHistory"] as! [AnyObject]).filter {
        return $0 is NSDictionary
    }
} else {
    for a in dic["simHistory"] as! [AnyObject] {
        if a is SimHistory {
            newSimHistoryArr = (dic["simHistory"] as! [AnyObject]).filter {
                return ($0 as! SimHistory).status == self.filterBy
            }
            break
        }
    }
}
</code></pre>

<p>It worked fine before I converted my project to Swift 3.</p>

<p>The error is on these lines:</p>

<pre><code>newSimHistoryArr = (dic["simHistory"] as! [AnyObject]).filter{ return ($0 is NSDictionary)}
</code></pre>



<pre><code>newSimHistoryArr = (dic["simHistory"] as! [AnyObject]).filter{ return ($0 as! SimHistory).status == self.filterBy}
</code></pre>

<p>The error is:</p>

<blockquote>
  <p>Cannot invoke 'filter' with an argument list of type '((AnyObject) throws -> Bool)'</p>
</blockquote>

<p>I have no idea what went wrong ...</p>