1
votes

I'm trying to update Parse user info in my app, but I don't know how to update it.

In my view controller I have UsernameTxtField, NicknameTxtField, PasswordTxtField and UpdateButton.

I want the user to set information inside the text field, then press the Update button to update them on Parse.com.

How should I do a query?

var query = PFQuery(className: "_User")

How can I do that? Can someone give me a code similar to this?

2

2 Answers

3
votes

You would do the following to edit and save the PFUser's data:

if let currentUser = PFUser.currentUser(){
    currentUser["Username"] = "John Smith"
    //set other fields the same way....
    currentUser.saveInBackground()
}
0
votes

PFUser is a PFObject subclass, so you can easily edit it as any other Parse object.