I've certain methods which are repeated in many table views. Is it possible to move this implementation in separate common class? If yes then how? Code please. Is there any way to avoid this repetition?
One example of such implementation is giving space in the footer below last cell which I end up in repeating.
extension MessagesViewController: UITableViewDelegate {
// Set space below 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 = .clear
return footerView
}
// Set height for footer
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 40
}
}