I have three CollectionView's. One main collection (Board) view is the game board, which is on auto-layout to be the biggest square possible in the available View space regardless of orientation or device. The second CollectionView (Left) is set up along the left hand edge of the Board and is set to be 30 pixels wide and the same height as the Board. The third CollectionView (Bottom) is set up along the bottom of the Board and is set to be 30 pixels tall and the same width as the Board. I use Layouts to get the content size and cell size within each and cell is always a square. The Left and Bottom CollectionViews sync with the scrolling of the Board CollectionView. This all worked perfectly when I first created it maybe ten years ago.
However, I am currently updating all my apps in Swift (as well as other things). And now, the Left and Bottom CollectionView's are no longer in Sync with the Board. However, it isn't because they don't move correctly (they do). It's because the cell size in the Left and Bottom are not the same size as the Board. I think it has to do with the timing of the Layouts. It configures the size of the cells (in the Left and Bottom) before it resizes the height/width to match the size of the Board.
I've tested this on various devices and it works perfectly fine on the iPad mini, but none of the others. Probably not coincidentally, in the Storyboard setup, I use the iPad mini as the device (to ensure that what I'm doing fits on the smallest screen available). So, the cells are sized as if it were running on an iPad mini even when it's not. The Left and Bottom views themselves are updated to the same height/width of the Board, but the cell sizes are not subsequently updated. Thus, no more syncing.
I tried to reload the data in the ViewWillAppear (first Board, then Left and Bottom), but that does resolve this issue. I had thought that the layout should be handled after any size shifts to the view, but I guess not.
Any thoughts on how to resolve this?
Thanks.
So, in the end, what was happening was that within the FlowLayout class, the layoutAttributesForItem was using an array of Rects to determine the size of each section and instead of changing to the new sizes, it was simply appending the new sizes to the end of the array, so the UI was always using the same set of rect within the array, regardless of what was happening to the view. The solution was to remove all the items from the array and reset the array with the new size rects each time the view changed size. It now works perfectly well. Thanks for the help on this, the notes above led me to this resulting solution.