Вы можете использовать метод делегата didSelectRowAt
, который находится в UITableViewDelegate
.
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let job = jobs[indexPath.row] // get the Object
let image = job.jobImage // get the Image
let destinationVC = DetailVC()
destinationVC.jobDetails = JobDetailViewController.JobDetails(jobDetail: jobs[indexPath.row].text, userName: jobs[indexPath.row].addedByUser!, jobImage: jobs[indexPath.row].jobImage)
destinationVC.performSegueWithIdentifier("toDetails", sender: self)
}
Подробнее о UITableViewDelegate
здесь .