Skip to content

Instantly share code, notes, and snippets.

View MarvinNazari's full-sized avatar

Marvin Nazari MarvinNazari

View GitHub Profile
extension UIViewController {
func smoothlyDeselectItems(in collectionView: UICollectionView) {
let selectedIndexPaths = collectionView.indexPathsForSelectedItems ?? []
guard let transitionCoordinator = transitionCoordinator else {
selectedIndexPaths.forEach {
collectionView.deselectItem(at: $0, animated: false)
}