How to build Instagram comment-replies UI

I want to build Instagram like comment - replies UI.

Here are few questions.

1 - Nested CollectionView. I first built comments UI with collectionView. But now facing self-cell sizing issue on how to update the height of cell dynamically based on the nested collectionView of replies.

2 - Nested Tableview. So I thought maybe with automatic dimension set up with tableview. It'd be much simpler to build comment-replies UI. But I read on Stack Overflow that nested tableViews are not recommended because it might mess up with scrolls .

3 - So what would be the best way to build comment-replies UI just like Instagram?

In general you should avoid nesting collection or table views inside of each other exactly because of the issue you are running into. The most straight forward way is usually to use a single collection view with compositional layout and just define the whole layout in there.

How to build Instagram comment-replies UI
 
 
Q