I can't find the API to programmatically check or unckeck the multi select accessory in a UICollectionViewListCell accordingly to the model when the cell is displayed.
This is my cell registration:
This is my cell registration:
Code Block let cellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, Item> { (cell, indexPath, item) in var content = cell.defaultContentConfiguration() content.text = item.title cell.contentConfiguration = content cell.accessories = [.multiselect(displayed: .always, options: UICellAccessory.MultiselectOptions())] }
The multiselect accessory follows the selected state of the cell. In other words, when you select items in the UICollectionView, the collection view will enable the selected state on the cells corresponding to those selected items, and the multiselect accessory in these cells will automatically show the checked (filled) appearance in that state.
You can use the UICollectionView API selectItem(at:animated:scrollPosition:) (documentation) to programmatically manage the selected items.
You can use the UICollectionView API selectItem(at:animated:scrollPosition:) (documentation) to programmatically manage the selected items.