As i have used this code to get current page index in pageControl. But this function can't distinguish if scrollView is for Which collectionView.
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
if collectionView == self.brandCollectionView {
brandPageControl.currentPage = Int(scrollView.contentOffset.x) / Int(scrollView.frame.width)
} else {
brandPageControl.currentPage = Int(scrollView.contentOffset.x) / Int(scrollView.frame.width)
}
}
Solution is working :
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
if scrollView == self.collectionView {
//code for this scrollView1
} else {
//code for this scrollView2
}
}