UICollectionViewCompositionalLayout + paging + rotation == not handled correctly

Am trying to get away from using UIPageViewController for a number of reasons, not the least of which is several perennial crashes that happen occasionally that I've never been able to reproduce myself but happen enough in the wild to be noticeable.

I have high hopes for the new UICollectionViewCompositionalLayout in iOS 13 SDK; have worked around the safeArea issue.

However, I cannot find a way to workaround or fix the problem that occurs when I rotate the device. Before rotation things are great, paging works, etc. Then when I do rotate the device the collectionView is scrolled such that I see half of two separate cells. Basically the current cell is not handled correctly.

Any ideas or suggestions?

Below is my layout for reference. Its as basic as one can get.

Code Block extension ViewController {
    private func createLayout() -> UICollectionViewLayout {
        let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalHeight(1.0))
        let item = NSCollectionLayoutItem(layoutSize: itemSize)
        let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalHeight(1.0))
        let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitems: [item])
        let section = NSCollectionLayoutSection(group: group)
        section.orthogonalScrollingBehavior = .groupPaging
        let layout = UICollectionViewCompositionalLayout(section: section)
        return layout
    }
}


Update: I noticed that if touch the screen the animation completes and the entire current cell is displayed as expected.

I have this same issue I am trying to solve.

UICollectionViewCompositionalLayout + paging + rotation == not handled correctly
 
 
Q