I am trying to set the height of each cell in the table view depending on the identifier. I do not want to use indexPath.row, because the i am filling the cell from an array containing a flag for each type of cell and the order is random. Exactly 3 types of cells.
I used this code but it causing an error:
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let cell = tableV.cellForRow(at: indexPath)
if(cell?.reuseIdentifier == "homeFeaturedR"){
return 200
}else{
return 360
}
}
The error is at this line:
let cell = tableV.cellForRow(at: indexPath)
Thank you.