Ios 无法转换类型为';Int';到预期的参数类型';indexath';
只需使用Ios 无法转换类型为';Int';到预期的参数类型';indexath';,ios,swift,Ios,Swift,只需使用forEach循环即可 if !isEditing { collectionView.indexPathsForSelectedItems?.compactMap({ $0 }).forEach {_ in collectionView.deselectItem(at: 0, animated: true) // Cannot convert value of type 'Int' to expected argument type 'IndexP
forEach
循环即可
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'
对于
at:0
您是指at:$0
?是@matt For at:0您是指at:$0吗?
collectionView.indexPathsForSelectedItems?.forEach({
collectionView.deselectItem(at:$0, animated: true)
})