In my tableView I set a separator line between cells. I am allowing selection of multiple cells. Here\'s my code for setting selected cell background color:
Past it in your UITableViewCell class.
override func layoutSubviews() { super.layoutSubviews() subviews.forEach { (view) in if type(of: view).description() == "_UITableViewCellSeparatorView" { view.alpha = 1.0 } } }