When you create a UITableView with the UITableViewStyleGrouped style, it adds quite a lot of space in between the actual tableviewcells and the bor
UITableView
UITableViewStyleGrouped
Swift 5 onwards:
tableView.contentInsetAdjustmentBehavior = .never
Older Swift. Use it in the viewDidLoad() method.
viewDidLoad()
tableView.tableHeaderView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 0.0, height: Double.leastNormalMagnitude))