When I set up a collectionView for example and I set a VC as its delegate (UICollectionViewDelegate), I can't understand when the delegate is called.
Is it called before the collectionView is displayed. or when it is already displayed? Because some methods seem to provide important feature for laying out of the object (such as number of items in section) but other methods seem to provide less "important task".
Till now I couldn't grasp this important concept of delegation in iOS development.
The delegation methods are called according to events. please refer to this link https://developer.apple.com/documentation/uikit/uicollectionviewdelegate
For example, scrollViewDidScroll method is called when user is scrolling. And collectionView methods is called when the collectionview is mounted.
The delegate can be meant as interface and it is calling defined methods in UICollectionView class.