In ios15 and Xcode 13 (beta)

In the size inspector of the collection view (in the main storyboard), on must select “none” for the “Estimate Size”, a new setting. Otherwise, the size of the cells will be modified and stop working well with a device rotation.