Answers for "swift collection view deselects item when scroll off screen"

0

swift collection view deselects item when scroll off screen

class MyViewController {

    var selectedIndexes = [IndexPath]()

    func cellForItem(indexPath) {
       cell.isSelected =  selectedIndexes.contains(indexPath)
    }

    func didSelectCell(indexPath) {
        if selectedIndexes.contains(indexPath) {
            selectedIndexes.remove(indexPath)
        } else if selectedIndexes.count < limiit {
            selectedIndexes.append(indexPath)
        }
    }
}
Posted by: Guest on June-15-2021

Code answers related to "swift collection view deselects item when scroll off screen"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language