UIKit integration
Add UIKit views to your SwiftUI app, or use SwiftUI views in your UIKit app.
Overview
Integrate SwiftUI with your app’s existing content using hosting controllers to add SwiftUI views into UIKit interfaces. A hosting controller wraps a set of SwiftUI views in a form that you can then add to your storyboard-based app.
[Image]
You can also add UIKit views and view controllers to your SwiftUI interfaces. A representable object wraps the designated view or view controller, and facilitates communication between the wrapped object and your SwiftUI views.
For design guidance, see the following sections in the Human Interface Guidelines:
Topics
Displaying SwiftUI views in UIKit
Using SwiftUI with UIKitUnifying your app’s animationsUIHostingControllerUIHostingControllerSizingOptionsUIHostingConfigurationUIHostingSceneDelegate
Adding UIKit views to SwiftUI view hierarchies
UIViewRepresentableUIViewRepresentableContextUIViewControllerRepresentableUIViewControllerRepresentableContext
Adding UIKit gesture recognizers into SwiftUI view hierarchies
UIGestureRecognizerRepresentableUIGestureRecognizerRepresentableContextUIGestureRecognizerRepresentableCoordinateSpaceConverter