I'm trying to put a swipe action on a UICollectionView cell of type UICollectionViewListCell. I get the error that
'Value of type 'UICollectionViewListCell' has no member 'leadingSwipeActionsConfiguration'. That's ridiculous because it does have said member. Below is my code. Can anybody tell me what I'm doing wrong?
'Value of type 'UICollectionViewListCell' has no member 'leadingSwipeActionsConfiguration'. That's ridiculous because it does have said member. Below is my code. Can anybody tell me what I'm doing wrong?
Code Block let plainRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, Vacation> { (cell, indexPath, vacation) in var content = cell.defaultContentConfiguration() content.text = "Just a normal cell" cell.contentConfiguration = content let actionHandler: UIContextualAction.Handler = { action, view, completion in print("The action is done!") completion(true) } let action = UIContextualAction(style: .destructive, title: "Delete", handler: actionHandler) action.image = UIImage(systemName: "checkmark") action.backgroundColor = .systemGreen cell.leadingSwipeActionsConfiguration = UISwipeActionsConfiguration(actions: [action]) }
In iOS 14 beta 2, the swipe action API was moved to UICollectionLayoutListConfiguration. Please see this answer for more details.