Issue: I have a table view in complaintController which has "open" buttons in it. Whenever I press on the open button I segue to DetailComplaintViewController with the data of that row, but when I go back to ComplaintController and select a different button I am presented with the same data from previous selection.
NOTE - I have created a segue from button in cell of tableView.
This is the code I am using to segue from ComplaintController to DetailComplaintController.
var passRow = 0
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{
let billCell = tableView.dequeueReusableCell(withIdentifier: "complaintCell") as! ComplaintTableViewCell
billCell.openBtn.tag = indexPath.row
billCell.openBtn.addTarget(self, action: #selector(btnClicked), for: .touchUpInside)
return billCell
}
func btnClicked(sender: UIButton) {
passRow = sender.tag
print("Position......\(sender.tag)")
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let rVC = segue.destination as? DetailComplaintViewController
rVC?.issueType = self.complaintListArray[passRow].issueType
rVC?.issuedescription = self.complaintListArray[passRow].description
rVC?.issuedate = self.complaintListArray[passRow].issueDate
}