Skip to content

Instantly share code, notes, and snippets.

@oscarmorrison
Last active August 29, 2015 14:20
Show Gist options
  • Save oscarmorrison/80a448f266d89508bd6f to your computer and use it in GitHub Desktop.
Save oscarmorrison/80a448f266d89508bd6f to your computer and use it in GitHub Desktop.
Parse objects from PFQuery and Store only objects != current user
var usernames = [PFUser]()
var currentUser = PFUser.currentUser()
override func viewDidLoad() {
super.viewDidLoad()
var query = PFUser.query()
query?.findObjectsInBackgroundWithBlock({ (objects, error: NSError?) -> Void in
if error == nil{
for username in objects as Array!{
if(self.currentUser?.objectId != username.objectId){
self.usernames.append(username as! PFUser)
}
}
self.tableView.reloadData()
}else{ println("error could not get usernames")}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment