So my goal is to make the tableview cells in my dashboard populate with the specific field "event_name" of the documents in my Firestore collection. Here is my code that I came up with by using the Firebase docs.
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: Constants.CellDetails.cellName, for: indexPath) as! SwipeTableViewCell
cell.delegate = self
db.collection("school_users").whereField("event_cost", isEqualTo: "Free")
.getDocuments() { (querySnapshot, err) in
if let err = err {
print("Error getting documents: \(err)")
} else {
for document in querySnapshot!.documents {
cell.textLabel?.text = "\(document.data())"
}
}
}
So basically, what I expected to happen was that the code would magically have the field name populated in the cell, unrealistic I know. I will provide a screenshot of what actually happened .
So yeah, if anybody knows a way I can do a very specific query for the field and be able to populate it within the cells, that would be great. Thanks.