title: Swift SearchVC navbar
body: <p>I am having trouble with the absolute LAST piece of my app , everything else is finished and functional. I used Ray Wunderlich tutorial to help me get this search feature working but I am stuck. The page loads and I can type usernames, but no results show up. The search is its own VC, which I Get through via tab bar. My aim is to search for users on my app by username for example "Kobe Bryant". The main home page shows all my users' posts. Not sure why no results are coming up any tips would be great. Much appreciated. This is my code for the search VC.</p>
  
  <pre><code>@IBOutlet weak var tableView: UITableView!
  var users = [PFUser]()
  var filteredUsers = [PFUser]()
  let searchController = UISearchController(searchResultsController: nil)
  
  override func viewDidLoad() {
      super.viewDidLoad()
      tableView.dataSource = self
      tableView.delegate = self
      navigationController?.navigationBar.prefersLargeTitles = true
  
      // Setup the Search Controller
      navigationItem.searchController = searchController
      navigationItem.hidesSearchBarWhenScrolling = false
      searchController.searchResultsUpdater = self
      searchController.obscuresBackgroundDuringPresentation = false
      searchController.searchBar.placeholder = "Search Users"
      definesPresentationContext = true
  
      fetchUsers()
  }
  
  // MARK: - Private instance methods
  
  func searchBarIsEmpty() -&gt; Bool {
      // Returns true if the text is empty or nil
      return searchController.searchBar.text?.isEmpty ?? true
  }
  
  func filterContentForSearchText(_ searchText: String, scope: String = "All") {
      filteredUsers = users.filter({( user : PFUser) -&gt; Bool in
          return (user.username?.lowercased().contains(searchText.lowercased()))!
      })
      self.tableView.reloadData()
  }
  
  func fetchUsers() {
      let userQuery = PFUser.query()
      userQuery?.includeKey("username")
      userQuery?.findObjectsInBackground{ (objects: [PFObject]?, error) in
          if error != nil {
              print("Error")
              return
          }
          guard let objects = objects as? [PFUser] else { return }
          self.users = objects
          self.tableView.reloadData()
      }
  }
  
  func isFiltering() -&gt; Bool {
      return searchController.isActive &amp;&amp; !searchBarIsEmpty()
  }
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
      let cell = tableView.dequeueReusableCell(withIdentifier: "FollowingCell", for: indexPath) as! FollowingTableViewCell
      let user: PFUser
      if isFiltering() {
          user = filteredUsers[indexPath.row]
      } else {
          user = users[indexPath.row]
      }
      cell.usernameLabel?.text = user.username
      return cell
  }
  
  func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      if isFiltering() {
          return filteredUsers.count
      }
  
  
      return users.count
  }
  
  
  }
  
  extension SearchViewController: UISearchResultsUpdating {
      // MARK: - UISearchResultsUpdating Delegate
      func updateSearchResults(for searchController: UISearchController) {
          filterContentForSearchText(searchController.searchBar.text!)
      }
  }
  </code></pre>