I am trying to retrieve the the current user's friends by accessing the "friends" column in Parse. The way I set the friends up is by having the user select users in another view that are then added to a Relation called "friends" in their User row in Parse. I can get the users to save as a Relation in Parse but I can't figure out how to actually get those Relationed Users to show up in the Friends Table View. Here is my current code:
override func queryForTable() -> PFQuery {
let currentuser = PFUser.currentUser()
// Start the query object
let query = PFQuery(className: "_User")
// Add a where clause if there is a search criteria
if FriendSearch.text != "" {
query.whereKey("username", containsString: FriendSearch.text)
}
// Order the results
query.orderByDescending("score")
// Return the query object
return query
}
How do I get the current user's related users to appear in the PFTable View Controller? Thanks
You don't create a new query (particularly using the private class name for users). Instead you get the relation from the user and ask the relation for its query. Once you have that you can add additional parameters to it and return it.