ios - Writing data to firebase without overwriting it. Swift -
i got app working on firebase, have small problem of overwriting data.
the action:
@ibaction func gem(_ sender: uibutton) { self.ref.child("users").child(personnr.text!).setvalue(["fornavn": fornavn.text!]) self.ref.child("users").child(personnr.text!).setvalue(["efternavn": efternavn.text!]) } the problem writes first command, erases , writes second one. im new programming, simply.
i have clarified text fields user write data uploaded database.
@iboutlet weak var fornavn: uitextfield! @iboutlet weak var efternavn: uitextfield! @iboutlet weak var personnr: uitextfield! @iboutlet weak var korekort: uitextfield! any clues on how avoid overwrite?
that pretty normal can make dictionary
let data = ["fornavn": fornavn.text!,"efternavn": efternavn.text!] and
self.ref.child("users").child(personnr.text!).setvalue(data) what stores both fornavn , efternavn data under personnr.text parent node
Comments
Post a Comment