Having Layout issue using WKWebView inside UICollectionViewCompositionalLayout

I had built a UICollectionViewCompositionalLayout with a list configuration (estimated height for cell).
One of my cells contains a WKWebview. So I would like a single cell layout change after WKWebView finished loading. I got the web view content height and set height constraint on web view.

I expected the web view cell will update layout but it's not working. It is always using the estimated height.

I had tried
Code Block
collectionViewLayout.invalidateLayout()

But it brings performance issue when the collection view contains multiple web view cells.

Does anyone know how to make the Auto Layout work?

Having Layout issue using WKWebView inside UICollectionViewCompositionalLayout
 
 
Q