How does SwiftUI integrate with UIKit?
Two directions
UIKit inside SwiftUI — UIViewRepresentable / UIViewControllerRepresentable:
makeUIView(context:)— create the object once;updateUIView(_:context:)— sync it with new SwiftUI parameters; it runs on every parent update, so it must diff ("if the text has not changed, leave it") rather than recreate;makeCoordinator()— a bridge object for delegates and target-action; it lives as long as the view;sizeThatFits(_:uiView:context:)(iOS 16) — report the intrinsic size to SwiftUI.
SwiftUI inside UIKit — UIHostingController(rootView:) as a regular controller (child VC, push, modal) and UIHostingConfiguration (iOS 16) for the contents of UITableView/UICollectionView cells. sizingOptions = [.intrinsicContentSize] lets the hosting controller update its size when the content changes.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep