I've got a UICollectionView and a UITableView on the same controller. For reasons, I also need to implement some scrollView delegate methods. How can I distinguish which component is triggering the delegate ( e.g is it the table or the UICollectionView? )
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
//need to distinguish which component
//triggered the delegate here
snapToNearestCell(collectionView)
}
The table view and the collection view are the scroll view that's passed into that method. Set tags to the table view and the collection view and you are able to reason about who called that delegate method.