title: Unable to filter tableview created using array of dictionary
body: <p>I am new to swift and Xcode and I have been progressing along with an app that has tableview (of employees with first name space last name) created using a plist dictionary used as NSarray. I am trying to add a search feature.</p>
  
  <p>Here is my code:</p>
  
  <p>var employeeSearch = Array>()</p>
  
  <pre><code>let searchController = UISearchController(searchResultsController: nil)
  
  func getSwiftArrayFromPlist() -&gt; (Array&lt;Dictionary&lt;String,String&gt;&gt;) {
  
      let path = Bundle.main.path(forResource: "Sheet1", ofType: "plist")
      var arr: NSArray?
      arr = NSArray(contentsOfFile: path!)
      return (arr as? Array&lt;Dictionary&lt;String,String&gt;&gt;)!
  }
  
  
  func searchBarIsEmpty() -&gt; Bool {
      // Returns true if the text is empty or nil
      return searchController.searchBar.text?.isEmpty ?? true
  }
  </code></pre>
  
  <p>// no errors in above  function </p>
  
  <p>// I am getting a number of errors in the function below</p>
  
  <pre><code>func searchBar(searchBar: UISearchBar, textDidChange searchText: String) {
      employeeSearch = getSwiftArrayFromPlist().filter { $0["lastname".lowercased().contains(searchText.lowercased()]}
      print(employeeSearch)
      searchActive = !employeeSearch.isEmpty
      tblData.reloadData()
  }
  //getting many errors in above attempt to get a filtered array of dictionary to reload data in tableview 
  </code></pre>
  
  <p>Any help is appreciated. Thanks.</p>
  
  <p>//Mar 1 - Finally this worked, but only equals condition was going without errors. My expectation was to have contains feature.. 
      func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {</p>
  
  <pre><code>    if searchBar.text == nil || searchBar.text == "" {
          isSearching = false
          view.endEditing(true)
          employee1View.reloadData()
      } else {
          isSearching = true
          employeeSearch = getSwiftArrayFromPlist()
  
          currentEmployeeSearch = employeeSearch.filter {($0["lastname"]?.lowercased() == searchText.lowercased())}
          //currentEmployeeSearch = employeeSearch.filter {($0["lastname"]?.lowercased().contains(searchText.lowercased())}
          employee1View.reloadData()
      }
  }
  </code></pre>
  
  <p>// *****************************************</p>