Created
May 3, 2020 10:23
-
-
Save michzio/97fb248106ab0c49f4223dfc62ad0255 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
extension CollectionView { | |
class Coordinator: NSObject, UICollectionViewDelegate { | |
// MARK: - Properties | |
let parent: CollectionView | |
var dataSource: UICollectionViewDiffableDataSource<Section, Item>? | |
// MARK: - Init | |
init(_ parent: CollectionView) { | |
self.parent = parent | |
} | |
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { | |
guard let item = dataSource?.itemIdentifier(for: indexPath) else { return } | |
print("Item selected: \(item)") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment