Last active
February 25, 2020 02:54
-
-
Save aheze/8cde9e3e750d100ca7f076b53e0bc174 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { | |
if collectionView == baseCollectionView { | |
let alphabetLetter = baseCollectionViewArray[indexPath.item] | |
secondCollectionViewArray.append(alphabetLetter) | |
let newIndexPath = IndexPath(item: secondCollectionViewArray.count - 1, section: 0) | |
secondCollectionView.insertItems(at: [newIndexPath]) | |
///First, add a cell to the second collectionview. | |
baseCollectionViewArray.remove(at: indexPath.item) | |
baseCollectionView.deleteItems(at: [indexPath]) | |
///Now, remove it from the base collectionview. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment