UICollectionView trigger cell animation when bottom of cell is visible

Using a UICollectionView, I am trying to trigger in each cell an animation that would add some views in it. The thing is that I need to trigger these animations only when the bottom of the cell passes the bottom of the screen.

Of course, iOS provides methods that can tell me when a cell is about to be displayed, but I want to trigger my animation really when the cell is fully visible on screen (otherwise user won't see the animation)

Here is what I do and that actually works but there is probably a better option :

func scrollViewDidScroll(_ scrollView: UIScrollView) {
    let cells = self.collectionView.visibleCells
    for cell in cells {
        if cell is PublicationSingleMediaCollectionViewCell {
            guard let indexPath = collectionView.indexPath(for: cell) else {
                return
            }
            guard let frame = self.collectionView.layoutAttributesForItem(at: indexPath)?.frame else {
                return
            }
            if self.collectionView.bounds.contains(frame) {
                let cell = cell as! PublicationSingleMediaCollectionViewCell
                cell.animate()
            }
        }
    }
}