How to pass a cell to a function in tableView swift 3

Viewed 2717

I would like to pass a cell as a parameter to the function datePickerChanged(sender: UIDatePicker)

The below is the part of the code, where I would like to achieve that, can someone please advice how I can achieve that ?

class DailyTimesTVC: UITableViewController {

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let cell = Bundle.main.loadNibNamed("DailyTimesTableViewCell", owner: self, options: nil)?.first as! DailyTimesTableViewCell

        cell.datePicker.addTarget(self, action: #selector(datePickerChanged), for: .valueChanged)
    }


    func datePickerChanged(sender: UIDatePicker){
        // Here I would like to access the cell
    }

}
1 Answers
Related