h_a86 h_a86 - 1 year ago 85
iOS Question

iOS Swift 3 tableview custom cell error

Hi I am trying to add a custom cell to tableview in swift3 but getting a strange error. Here is the screenshot of error.

enter image description here

Help plz!!!

Answer Source

Write indexPath in place of IndexPath like this:

let cell = tableview.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! CustomCell

Also, make sure that CustomCell is subclass of UITableViewCell.