h_a86 h_a86 - 8 months ago 64
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.