I have a UIViewController
that has UITableView
and UICollectionView
. I want to do certain tasks when UICollectionView
is scrolled.
I've extended UIScrollViewDelegate
and wrote my code in
func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView)
But this method is called when both UITableView
and UICollectionView
are scrolled. How do I differentiate between the two views here? I tried
func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) {
if let cv = scrollView as? UICollectionView {
}
}
But it's not working. I tried po scrollView
and the output is <uninitialized>
.