basically, I'm trying to pass/use the cell instances (label.text) that I have already fetched from Firebase and assign it to the destination chatViewController
variables
I believe I'm facing an issue with the segue ,, after debugging my code the segue do not pass the data this way:
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { // 2
return users.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{
let cell = self.tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! TableViewCell
cell.nameLblCell.text = users[indexPath.row].name
cell.emailLblCell.text = users[indexPath.row].email
cell.profilePictureCell.downloadImage(from: users[indexPath.row].proPicURL)
return cell
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let instance = TableViewCell()
let chatVc = segue.destination as? ChatViewController
chatVc?.reciverImageVariable = instance.profilePictureCell.image!
chatVc?.destinationEmail = instance.emailLblCell.text!
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let userId = users[indexPath.row].id
self.performSegue(withIdentifier: "ShowChatView", sender: userId)
}