I have a UIButton within a TableViewCell and I would like to perform a segue when the UIButton is tapped, but I need to know the IndexPath.row value in the moment of perform the segue. Here more details:
Code block where I perform the segue:
}else if(segue.identifier == "toChat"){
let chatController = segue.destination as! ChatViewController
chatController.employeeSender = self.employeeData
//Currently I have tried this, but indexPath comes nil
if let indexPath = tableView.indexPathForSelectedRow {
chatController.employeeReceiver = (self.searchController!.isActive) ? self.searchResults[indexPath.row] : self.employeeArray[indexPath.row]
print("Receiver Data\(self.employeeArray[indexPath.row].alias)")
}
}
Thank you,