title: Cannot Select TableViewCell when Search Bar is active - iOS Swift
body: <p>I have a search bar that is connected to a table view. It works exactly as I want when the search bar is not active but cell selection is disabled when the search bar is active. I've debugged it and didSelectRowAtIndexPath is not even being called when I select a row when search is active. What could be causing this?</p>
  
  <p>Here's the relevant code:</p>
  
  <pre><code>class FabricsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate, UISearchControllerDelegate, UISearchDisplayDelegate {
  
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view, typically from a nib.
  
          searchController.delegate = self
          searchController.searchBar.delegate = self
          searchController.searchResultsUpdater = self
          searchController.dimsBackgroundDuringPresentation = false
          searchController.definesPresentationContext = false
          searchController.hidesNavigationBarDuringPresentation = false
          myTableView.tableHeaderView = searchController.searchBar
  
      }
  
      func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
          if searching {
              searching = false
              searchBar?.resignFirstResponder()
              FirebaseClient.sharedInstance.joinFabric(uid: self.appDelegate.uid!, fabricKey: allFabrics[indexPath.row].key)
              updateFabricList()
          } else {
               appDelegate.selectedFabricKey = joinedFabrics[indexPath.row].key
               performSegue(withIdentifier: "fabricSelected", sender: self)
          }
          myTableView.deselectRow(at: indexPath, animated: false)
      }
  
      func filterContentForSearchText(searchText: String, scope: String = "All") {
          if let allFabrics = allFabrics {
              filteredFabrics = allFabrics.filter { fabric in
                  return (fabric.name.lowercased().contains(searchText.lowercased()))
              }
              myTableView.reloadData()
              myTableView.setContentOffset(CGPoint.zero, animated: false)
          }
      }
  
  }
  
  extension FabricsViewController: UISearchResultsUpdating {
      func updateSearchResults(for: UISearchController) {
          filterContentForSearchText(searchText: searchController.searchBar.text!)
      }
  }
  </code></pre>