Downsides to NOT calling UIViewController.addChild, .didMove, etc when embedding views from other view controllers

I recently came across an example of something you might lose if you don’t add the UIHostingViewContoller as a child of the parent view controller in this article about using SwiftUI views in self-sizing table view cells. If you don’t add it as a child, the height of the cell holding its view is not always calculated correctly.

https://noahgilmore.com/blog/swiftui-self-sizing-cells/#view-controller-containment

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top