[Solved] How to get all data for current user using Parse in Swift?


This is a poorly asked question, you provide no code nor do you show any effort on your own part to solve the problem. However, I myself remember struggling with this quite a but so here is how I accomplish this…

var arrayForData = Array()
var arrayForMoreData = Array()
var arrayForEvenMoreData = Array()

func fetchUserData() {
    let userQuery: PFQuery = PFUser.query()!

    userQuery.whereKey("username", equalTo: (currentUser?.username)!)
    userQuery.findObjectsInBackgroundWithBlock({
        (users, error) -> Void in

        var someData = users!
        var someMoreData = users!
        var thirdSetOfData = users!

        if error == nil {
            if someData.count >= 1 {
                for i in 0...users!.count-1 {
                    self.arrayForData.append(someData[i].valueForKey("columnNameParse1") as! Int)
                    self.arrayForMoreData.append(someMoreData[i].valueForKey("columnNameParse2") as! Double)
                    self.arrayForEvenMoreData.append(thirdSetOfData[i].valueForKey("columnNameParse3") as! String)
                }
            }

            self.usersArray = users as! [PFUser]
            self.tableView.reloadData()
        } else {
            print(error)
        }
    })
}

0

solved How to get all data for current user using Parse in Swift?