Post

Replies

Boosts

Views

Activity

How change the Selection Color in Compositional Layouts in CollectionView
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. let 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 } though it applys the selection color, default cell configuration got override. is there any other approach to change the selection color
1
0
1.5k
Aug ’20