I have an array of strings and I am trying to populate it through firebase. It is a chat application and when a user creates a room he or she names the room. When the user logs in and goes to the landing page it queries all the rooms that he or she is participating in and I want that to fill the tableview. In the firebase docs i found childrenCount but I cannot seem to get it to work. This is what I have tried so far
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
let ref = firebase.child("users").child(fUID).child("participating")
ref.observe(.value, with: { (snapshot: FIRDataSnapshot!) in
print(snapshot.childrenCount)
rooms.count = snapshot.childrenCount
})
return rooms.count
}
I get an error that count is a get only property. How to i populate that array count?