Как удалить разделитель у последней ячейки в статическом UITableView


#1

Имеется статический UITableView. Не получается удалить разделитель последней ячейки(который расположен под ячейкой). Подходы с использованием tableView.tableFooterView = UIView() или tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: 1)) не работают - разделитель не удаляется. Спасибо за помощь


#2
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
    let isLastCell = indexPath.row == dataArray.count - 1
    let defaultInset = tableView.separatorInset
    
    if isLastCell {
        cell.separatorInset = UIEdgeInsets(top: 0, left: cell.bounds.width, bottom: 0, right: 0)
    } else {
        cell.separatorInset = defaultInset
    }
}

#3

спасибо, данный способ сработал