Last active
July 26, 2020 20:13
-
-
Save aheze/d3b74cb3eb4fb9da0331700d534ec38a 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]) | |
baseCollectionViewArray.remove(at: indexPath.item) | |
baseCollectionView.deleteItems(at: [indexPath]) | |
} else { | |
///ADD THIS STUFF | |
let alphabetLetter = secondCollectionViewArray[indexPath.item] | |
baseCollectionViewArray.insert(alphabetLetter, at: 0) | |
let newIndexPath = IndexPath(item: 0, section: 0) | |
///I guess we'll put it at the front for now? | |
baseCollectionView.insertItems(at: [newIndexPath]) | |
secondCollectionViewArray.remove(at: indexPath.item) | |
secondCollectionView.deleteItems(at: [indexPath]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment