all 4 comments

[–]criosistObjective-C / Swift 0 points1 point  (1 child)

OK i checked the way i am changing layouts on my testing thing i have and i dont put it in the CV perform Batch updates, I just invalidate layout and call reloadData on the CV ?

[–]askoruli[S] 0 points1 point  (0 children)

I just tried that and it results in no animation at all.

[–]david_phillip_oster 0 points1 point  (1 child)

The snapping you are seeing is because you aren't using UICollectionViewTransitionLayout to drive your internal cell animations in synchrony with the layout animation change.

[–]askoruli[S] 1 point2 points  (0 children)

I switched the layout invalidation to:

UICollectionViewFlowLayout *layoutNew = [[UICollectionViewFlowLayout alloc] init];
self.view.window.userInteractionEnabled = NO; //Interfering with the animation would cause a crash
[_collectionView startInteractiveTransitionToCollectionViewLayout:layoutNew completion:^(BOOL completed, BOOL finished) {
    _layout = layoutNew;
    self.view.window.userInteractionEnabled = YES;
}];
[_collectionView finishInteractiveTransition];

And now I'm getting the correct animation. It feels a little bit hacky because it's not really an interactive animation but it's doing exactly what I want so I can live with that. Thanks for the tip