We looked at how to use existing UIKit views in SwiftUI. Now we’ll look at how to use SwiftUI in UIKit.
You may have an existing project that you want to add new UI using SwiftUI. So you have your Storyboard setup for all your interface and navigation. It’s actually pretty easy to add SwiftUI views to your project.
When we incorporated a UIView in our app, we used UIViewRepresentable. That protocol facilitated creating our UIView instances.
UIKit provides a mechanism for doing it the other way around. There’s a UIViewController subclass called UIHostingController. Similarly, for macOS development, ...