Вы можете создать расширение для UITableViewCell:
extension UITableViewCell {
func hideSeparator() {
self.separatorInset = UIEdgeInsets(top: 0, left: self.bounds.size.width, bottom: 0, right: 0)
}
func showSeparator() {
self.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
}
}
Так что вы можете использовать его в tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath)
if indexPath.section == 1 {
cell.hideSeparator()
} else {
cell.showSeparator()
}