I have one TableView, and inside that I have another TableView, in which each cell contains a switch.
When I click on that switch, I want to send the data for that cell to my view controller. How can I achieve this?
Here is my approach:
I created a protocol from where I am sending position clicked from inner TableView to outer TableView, but I am not able to get the complete object, and I don't know how to proceed further.
Inner TableView cell switch clicked :
@IBAction func switchClicked(_ sender: UISwitch) {
//position clicked
print("inside cell clicked>>\(sender.tag)")
cellDelegate?.tableViewCellClicked(position: sender.tag, type:
"SwitchClicked")
}
Method call in outer TableView class :
func tableViewCellClicked(position: Int, type: Any) {
print("position\(position)")
}