reloading visible uicollectionviewcell when nested in uitableviewcell reloading visible uicollectionviewcell when nested in uitableviewcell swift swift

reloading visible uicollectionviewcell when nested in uitableviewcell


You should probably move the call to configure the cell to the willDisplayCell: method instead. You can remove it from the cellForItemAtIndexPath method. This is the correct time to configure any visual aspects of the cell to be displayed.

func collectionView(collectionView: UICollectionView,    willDisplayCell cell: UICollectionViewCell,    forItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {    let row = indexPath.row    let workout = workouts[row]    cell.configCell(workout)    return cell}


The problem lies in the fact that:the tableViewCell owns the data that is used for configuring the collectionViewCell.


If you want your collectionViewCell to update without the need for tableView.reloadData, the data that is used for configuring the collectionViewCell(in your case 'workout') must be fetched from elsewhere than from the tableViewCell.