Is there a way to update the database with a dynamic id as a key?
Let's say I want the database to look like this:
- Data
- dynamic key
- data 1
- data 2
This key is supposed to grow every time databaseRef.updateChildValues(addObject)
is being called.
Further more, is there a way to set a var as a key? I've tried this but it didn't work:
var addId: Int = 0
func updateData() {
...
addId += 1
let addObject = [
addId: someData
] as [String: Any]
databaseRef.updateChildValues(addObject)
}