How to remove UITableView section header separator
Try this:
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerView = UIView()
headerView.backgroundColor = UIColor.clear
return headerView
}
Don't know why you are returning UITableViewCell
in viewForHeaderInSection
method so may be it is possible that is showing separator of that UITableViewCell
. Try returning the contentView
of cell instead of cell from viewForHeaderInSection
method.
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let cell = tableView.dequeueReusableCell(withIdentifier: "headerTableViewCell")
return cell.contentView
}