Okay I can give you the favcell code it's a custom cell, the segue to HighlightsVC is put where the button is.
Thanks for showing your code and clarifying.
I'm also counting on this:
I have to get rid of the button action and do a segue with storyboard.
As you are connecting the segue from the button, insisting on using tableView(_:willSelectRowAt:)
does not make sense and you can remove it.
Please try the following prepare(for:sender:)
and tell us what you get.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "hs" {
print("this is the segue destination: \(segue.destination)")
if let button = sender as? UIButton {
var currentView: UIView = button
while let parentView = currentView.superview {
if let cell = parentView as? FavCell {
let selectedNameInCell = cell.name.text
print("name being transferred is \(selectedNameInCell)")
if let destinationController = segue.destination as? HighlightsVC, let destName = selectedNameInCell {
destinationController.playerName = destName
}
break
}
currentView = parentView
}
} else {
print("The segue is not from UIButton")
}
}
}