I know how to change the height of the section headers in the table view. But I am unable to find any solution to change the default spacing before the first section.
This worked for me with Swift 4. Modify your UITableView e.g. in viewDidLoad:
// Remove space between sections.
tableView.sectionHeaderHeight = 0
tableView.sectionFooterHeight = 0
// Remove space at top and bottom of tableView.
tableView.tableHeaderView = UIView(frame: CGRect(origin: .zero, size: CGSize(width: 0, height: CGFloat.leastNormalMagnitude)))
tableView.tableFooterView = UIView(frame: CGRect(origin: .zero, size: CGSize(width: 0, height: CGFloat.leastNormalMagnitude)))