indexPath and table view error

45 Views Asked by At

I'm constantly having this error and I can't fix it, could someone help me?

Error Image

Here's the code:

 func prepare(for segue: UIStoryboardSegue, sender: Any?){
    if segue.identifier == "detail" {
        let viewController = segue.destination as! DetailNewsController

        if let  indexPath = tableView.indexPathForSelectedRow {
            viewController.news = DownloadManager.sharedInstance.localArra[(indexPath as NSIndexPath).row]

            let cella = self.tableView.cellForRow(at: indexPath) as! NewsCell

            self.zoomTransition.sourceView = cella

            viewController.newsImage = cella.imageNews.image

            self.tableView.deselectRow(at: indexPath, animated:true)
        }
    }
}
1

There are 1 best solutions below

0
Daniel On

Apparently your tableView var, is not a UITableView instance, is a closure. If You are sure that is a UITableView try clean your project.