Closed shuhrat10 closed 7 years ago
@shuhrat10 sure thing, should be really easy! And you don't have to use any IGListKit stuff in fact:
let path = collectionView.indexPathForItem(at: point)
let object = adapter.object(atSection: path.section)
I wonder if this would be a good API on IGListAdapter
@jessesquires?
@rnystrom I did that, but I'm getting only section. I think once I get section cell, I need to convertPoint to get IndexPath from child IGCollectionView.
Ooooh, embedded collection view. I skipped over that. Here's a quick thought that might get you on the right path:
let path = collectionView.indexPathForItem(at: point)
let object = adapter.object(atSection: path.section)
if let cell = collectionView.cellForItem(at: path) as? EmbeddedCollectionViewCell,
let sectionController = adapter.sectionController(for: object) as? HorizontalSectionController {
let subPoint = cell.collectionView.convert(point, from: collectionView)
let subPath = cell.collectionView.indexPathForItem(at: subPoint)
let subObject = sectionController.adapter.object(atSection: subPath.section)
}
I'm using classes in our example project, assuming your setup is similar.
@rnystrom thank you very much! It's working as expected
Hi,
I have IGListKit with multiple sections which contain embedded IGCollectionView. I wonder how can I get master and child IndexPath from UIViewController and then get data for each IndexPath.
Thanks!