title: Search Bar in a TableView with Core Data (using Swift)
body: <p>I am making a <strong>TableViewController</strong> with Core Data. In fact the users can add new items to the Table View and these items are saved in <strong>Core Data</strong>. Everything has worked fine but when I add a <strong>Search Bar</strong> I'm blocked.</p>
  
  <p>I added a Search Bar but this function bellow create an error when I run the app in the simulator.</p>
  
  <pre><code>func updateSearchResultsForSearchController(searchController: UISearchController,)
  {
      filteredTableData.removeAll(keepCapacity: false)
      let searchPredicate = NSPredicate(format: "SELF CONTAINS[c] %@", searchController.searchBar.text)
      let array = (series as NSArray).filteredArrayUsingPredicate(searchPredicate)
      filteredTableData = array as! [String]
  
      self.tableView.reloadData()
  }
  </code></pre>
  
  <p>The error I get is " <em>terminating with uncaught exception of type NSException</em> "</p>
  
  <p>PS : I use Xcode 6.3.2 and all the code is in Swift.</p>