h_a86 h_a86 - 4 days ago 6
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

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.

Comments