prepareForTransition(to:)
Tells the layout object that it is about to be removed as the layout for the collection view.
Declaration
func prepareForTransition(to newLayout: UICollectionViewLayout)Parameters
- newLayout:
The layout object to be installed in the collection view at the end of the transition. You might use this object to provide different starting attributes depending on the final layout object.
Discussion
Prior to performing a layout transition, the collection view calls this method so that your layout object can perform any initial calculations needed to generate layout attributes.