Matt Butler Matt Butler - 25 days ago 9
Swift Question

Update existing data in Firebase (Swift)

Firebase Data Structure:

- 90384m590v834dfgok34
•userName: "Matt"
•values: ["test1", "test2"]

I am wanting to update the values inside of these firebase entries without replacing the whole thing. I know the update() function is what I need to do, but from the example I tried it is not working.

Also, how would I append a new item to the values array through the update() function?


Create a reference for the user whose values you'd like to update and use updateChildValues.

let ref = FIRDatabase.database().reference().child("users/90384m590v834dfgok34")

    "values": [