searchbar in swift using parse
<p>Hello I have been watching a video to do this code yet nothing is working I tried to play around the code and still didn't get what's wrong. the problem is that I don't have any mistake and when I run the code it's not showing results in the tableView. what I want to do is I want to search in parse user list.
here's the code:</p>

<pre><code>func searchBarSearchButtonClicked(searchBar: UISearchBar){
    searchBar.resignFirstResponder()
    print("search word =\(searchBar.text)")

    let usernameQuery = PFQuery(className: "User")
    usernameQuery.whereKey("username", containsString: searchBar.text)

    usernameQuery.findObjectsInBackgroundWithBlock {
        (results: [PFObject]?, error: NSError?) -&gt; Void in

        if error != nil {
            let myAlert = UIAlertController(title:"Alert", message:error?.localizedDescription, preferredStyle:UIAlertControllerStyle.Alert)

            let okAction = UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil)

            myAlert.addAction(okAction)

            self.presentViewController(myAlert, animated: true, completion: nil)

            return
        }
        if let objects = results! as? [PFObject]{
            self.searchResults.removeAll(keepCapacity: false)

            for object in objects{
                let usernameid = object.objectForKey("username") as! String
                self.searchResults.append(usernameid)
            }
            dispatch_async(dispatch_get_main_queue()){
                self.myTable.reloadData()
                self.mySearchBar.resignFirstResponder()
            }
        }
    }
</code></pre>

<p>}</p>

<pre><code>func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell{
    let myCell = tableView.dequeueReusableCellWithIdentifier("myCell", forIndexPath: indexPath)

    myCell.textLabel?.text = searchResults[indexPath.row]

    return myCell
}

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath){
    mySearchBar.resignFirstResponder()
}

func searchBarCancelButtonClicked(searchBar: UISearchBar){
    mySearchBar.resignFirstResponder()
    mySearchBar.text = ""
}


func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {

    return searchResults.count
}
</code></pre>

<p>}</p>