3

Does anyone have idea how to reload TableView that's inside of CollectionViewCustomCell? I have an IBOutlet of that Table and the only way to access that Table is inside cellForItemAtIndexPath method where I can access my CollectionViewCustomCell and through that access the Table.

cell.tableViewInsideOfCollectionViewCell.reloadData()

But this only works on the first load, when I change CollectionView source it will not reload TableView.

If you need anymore info, please ask!

Thanks in advance!

Shobhakar Tiwari
  • 7,862
  • 4
  • 36
  • 71
Srdjan
  • 106
  • 10

1 Answers1

2

You can get the cell using collectionView.cellForItem(at: IndexPath) method. Then cast it to the type of cell that contains the tableView. Now you have access to that cells properties and can reload the tableView.

guard let cell = collectionView.cellForItem(at: IndexPath(row: , section: )) as? CustomCellWithTableView else { return }
cell.tableView.reloadData()
Shobhakar Tiwari
  • 7,862
  • 4
  • 36
  • 71
JustinM
  • 2,202
  • 2
  • 14
  • 24