What is the best way to structure Firebase data to implement sections in my UITableview
. At this time I only have a standard UITableView
and I would like to divide it up in sections.
Now I'm writing just writing the data like this:
ref?.child("lists").child(listName).child(itemName).setValue(["added" : timeStamp, "itemName" : itemName, "amount" : itemAmount, "unit" : itemUnit])
This gives a Firebase structure like this:
"lists" : {
"-List1" : {
-"Apples" {
"added" : "9-7-2019 at: 16:58:47",
"itemName" : "Apples",
"amount" : 5,
"unit" : Pcs
},
-"Carrots" {
"added" : "10-7-2019 at: 12:01:22",
"itemName" : "Carrots",
"amount" : 2,
"unit" : Pcs
}
}
So when the user is adding Apples
to the list, I would like them to be able to write Fruits
in a textfield and then adding the item in that section
How is this best done, and how is this sorted in Swift
?