I have a collection view with videos that I play from cell willDisplay like this:
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
if let cell = cell as? UserFeedCollectionViewCell {
let post = feed[indexPath.row]
cell.videoplayer.play(post: post)
}
}
The videos take some time to load (some times 1-2 seconds) and I want to improve the performance of the app.
Is prefetching a good idea in this case? I am not sure what to put here
func collectionView(_ collectionView: UICollectionView, prefetchItemsAt indexPaths: [IndexPath]) {
}