Getting a table search function to work correctly?
<p>I am trying to get a search bar working for my table that shows JSON data. here is my search bar function:</p>

<pre><code>func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
    filtered = arrRes.filter({ (text) -&gt; Bool in
        let tmp: NSString = text
        let range = tmp.rangeOfString(searchText, options: NSStringCompareOptions.CaseInsensitiveSearch)
        return range.location != NSNotFound
    })
    if(filtered.count == 0){
        searchActive = false;
    } else {
        searchActive = true;
    }
    self.exercisesTableView.reloadData()
</code></pre>

<p>and here is my declared variable to store the data </p>

<pre><code>    var arrRes: [[NSObject: AnyObject]] = []
</code></pre>

<p>I am pulling the error:</p>

<blockquote>
  <p>Cannot invoke 'filter' with an argument list of type '(([NSObject : AnyObject]) throws -> Bool) Expected an argument list of type '((Dictionary) throws -> Bool)''</p>
</blockquote>

<p>Im sure this is to do with accessing the arrRes variable and its datatypes but im unsure of how to solve it?</p>

<p>Thanks for any insight </p>