Set a custom table view footer with Swift
Implement - delegate & datasource for your tableview and set both - heightForFooterInSection
& viewForFooterInSection
tableView.delegate = self
tableView.dataSource = self
// set view for footer
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let footerView = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: 40))
footerView.backgroundColor = UIColor.blue
return footerView
}
// set height for footer
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 40
}