I've recently worked with Compositional Layouts with Diffable DataSource. I've implemented side bar using UICollectionLayoutListConfiguration(appearance: .sidebar). I want to change the collection cell selection color to a custom color. I've used following code.
though it applys the selection color, default cell configuration got override. is there any other approach to change the selection colorlet cellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, MenuData> { (cell, indexPath, item) in
let red = UIView()
red.backgroundColor = UIColor.red
cell.selectedBackgroundView = red
var content = cell.defaultContentConfiguration()
content.text = item.menuTitle
content.image = item.image
cell.contentConfiguration = content
}