Post

Replies

Boosts

Views

Activity

Reply to I have a question regarding UI hang issues when using CompositionalLayout. As the number of cells displayed on the screen increases, the UI becomes less responsive. Could you provide advice or solutions for optimizing performance in such cases?
Hi, We’ve already checked our project using Time Profiler, and it turns out that every time items or sections are added to the collectionView, the layout for all sections is recalculated. For testing purposes, I’ve attached some simple code. When pressing the addSection or addItem buttons, instead of generating the layout only for the newly added sections and items through the createLayout method, the layout for all visible sections is being recreated. This is causing performance issues. Is there any way to resolve this? Is it the intended behavior of UICollectionViewCompositionalLayout to recalculate the layout for all sections and items whenever items are added, instead of checking the diff through NSDiffableDataSourceSnapshot and only generating the layout for the newly added sections and items? Thanks!
Sep ’24