title: Search bar isn't working and selection is gray (I want to be None)
body: <p>My search bar isn't working and I'm not sure why. I followed a tutorial online. There is a picture of my find friends view controller below and the code for the view controller. </p>
  
  <p>Also even though in my storyboard selection is set to "None" it is gray on ios.</p>
  
  <p>Not sure how to fix the selection part. Search bar fixed and solution is in comments below.</p>
  
  <p><img src="https://i.stack.imgur.com/9V6Q3.png" alt="Find Friends View Controller"></p>
  
  <pre><code>import UIKit
  
  class FindFriendsViewController: UIViewController {
  
      var users = [User]()
  
      @IBOutlet weak var tableView: UITableView!
      @IBOutlet weak var searchBar: UISearchBar!
  
      var searchItem = [String]()
      var searching = false
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          tableView.tableFooterView = UIView()
          tableView.rowHeight = 71
  
          let tap = UITapGestureRecognizer(target: self.view, action: #selector(UIView.endEditing(_:)))
          tap.cancelsTouchesInView = false
          self.view.addGestureRecognizer(tap)
      }
  
      override func viewWillAppear(_ animated: Bool) {
          super.viewWillAppear(animated)
  
          UserService.usersExcludingCurrentUser { [unowned self] (users) in
              self.users = users
  
              DispatchQueue.main.async {
                  self.tableView.reloadData()
              }
          }
      }
  }
  
      extension FindFriendsViewController: UITableViewDataSource, UITableViewDelegate {
  
  
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
  
          var usernamesArr = [String]()
          for user in users {
              usernamesArr.append(user.username)
          }
  
          if searching {
              return searchItem.count
          } else {
              return usernamesArr.count
          }
      }
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: "FindFriendsCell") as! FindFriendsCell
  
          let user = users[indexPath.row]
  
          var usernamesArr = [String]()
          for user in users {
              usernamesArr.append(user.username)
          }
  
          if searching {
              cell.usernameLabel?.text = searchItem[indexPath.row]
          } else {
              cell.usernameLabel?.text = usernamesArr[indexPath.row]
              cell.delegate = self
              configure(cell: cell, atIndexPath: indexPath)
          }
          return cell
      }
  
      func configure(cell: FindFriendsCell, atIndexPath indexPath: IndexPath) {
          let user = users[indexPath.row]
  
          cell.usernameLabel.text = user.username
          cell.followButton.isSelected = user.isFollowed
      }
  }
  
      extension FindFriendsViewController: FindFriendsCellDelegate {
      func didTapFollowButton(_ followButton: UIButton, on cell: FindFriendsCell) {
          guard let indexPath = tableView.indexPath(for: cell) else { return }
  
          followButton.isUserInteractionEnabled = false
          let followee = users[indexPath.row]
  
          FollowService.setIsFollowing(!followee.isFollowed, fromCurrentUserTo: followee) { (success) in
              defer {
                  followButton.isUserInteractionEnabled = true
              }
  
              guard success else { return }
  
              followee.isFollowed = !followee.isFollowed
              self.tableView.reloadRows(at: [indexPath], with: .none)
          }
      }
  }
  
      extension FindFriendsViewController: UISearchBarDelegate {
      func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
          var usernamesArr = [String]()
          for user in users {
              usernamesArr.append(user.username)
          }
          searchItem = usernamesArr.filter({$0.lowercased().prefix(searchText.count) == searchText.lowercased()})
          searching = true
          tableView.reloadData()
      }
  
      func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
          searching = false
          searchBar.text = ""
          tableView.reloadData()
      }
  }
  </code></pre>