if !isEditing {
collectionView.indexPathsForSelectedItems?.compactMap({ $0 }).forEach {_ in
collectionView.deselectItem(at: 0, animated: true)
// Cannot convert value of type 'Int' to expected argument type 'IndexPath'
只需使用forEach
循环
collectionView.indexPathsForSelectedItems?.forEach({
collectionView.deselectItem(at:$0, animated: true)
})