Does anyone know why my UISlider runs off the edge of my list cell? I am configuring it as a custom accessory.
Code:
let cellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, String>.init { cell, indexPath, itemIdentifier in
var config = cell.defaultContentConfiguration()
config.text = itemIdentifier
cell.contentConfiguration = config
let sliderAccessory = UICellAccessory.customView(configuration: .init(customView: UISlider(), placement: .trailing()))
cell.accessories = [sliderAccessory]
}
Result:

The answer is you have to set
maintainsFixedSizetotrueandreservedLayoutWidthtoactual. Define the width of the slider in the slider'sinit(frame:)initializer.