Footer in TableView

tableView.register(“FooterView”, forHeaderFooterViewReuseIdentifier: “FooterView”)

This is not working because the register function does not expect a String as first argument, but a NIB

“Cannot invoke ‘register’ with an argument list of type '(String, forHeaderFooterView)”

I succeeded like this:

override 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.lightGray
        
        return footerView
    }
    
    override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
        return 40.0
    }

But this will put a footer at the end of the section, and not at the end of the table