Daily iOS
SwiftUI

Embedding SwiftUI in UIKit

How do you put a SwiftUI screen into a UIKit app?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

From UIKit to SwiftUI, you use UIHostingController as a child view controller or as a push target, and on iOS 16 and later you put cells in with UIHostingConfiguration. The hosted view's size is propagated with sizingOptions.

Share a question