swiftui-uikit-interop

Wrap UIKit views and controllers for use in SwiftUI, and embed SwiftUI in UIKit via UIHostingController.

155|22|Updated Feb 24, 2026
One-click install
npx skills add https://github.com/omarshahine/HomeClaw --skill swiftui-uikit-interop-omarshahine
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftui-uikit-interop
Source: https://github.com/omarshahine/HomeClaw/tree/main/.agents/skills/swiftui-uikit-interop
Command: npx skills add https://github.com/omarshahine/HomeClaw --skill swiftui-uikit-interop-omarshahine

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill bridges the gap between SwiftUI and UIKit, enabling developers to integrate modern declarative UI with existing imperative codebases or leverage UIKit's extensive features within SwiftUI applications.

Core Features & Use Cases

  • Wrap UIKit Views/View Controllers: Integrate UIKit components like WKWebView, MKMapView, or custom UIViewControllers into your SwiftUI hierarchy using UIViewRepresentable and UIViewControllerRepresentable.
  • Embed SwiftUI in UIKit: Host SwiftUI views within UIKit view controllers using UIHostingController.
  • Incremental Migration: Facilitates a gradual transition from UIKit to SwiftUI by allowing parts of an application to be rewritten in SwiftUI while maintaining compatibility with the existing UIKit foundation.
  • Use Case: You need to display a complex, UIKit-based map view with custom annotations and delegate handling within a SwiftUI screen, or embed a SwiftUI settings panel into a legacy UIKit tab bar controller.

Quick Start

Use the swiftui-uikit-interop skill to wrap a WKWebView in a SwiftUI view.

Frequently Asked Questions about swiftui-uikit-interop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I wrap a UIKit view controller in SwiftUI?

To wrap a UIKit view controller in SwiftUI, use the UIViewControllerRepresentable protocol to bridge the imperative UIKit component into your declarative SwiftUI hierarchy. This pattern allows you to integrate complex UIKit screens while maintaining compatibility with your existing codebase.

What is the best way to embed SwiftUI views inside a UIKit app?

The best way to embed SwiftUI views inside a UIKit app is by using UIHostingController. This allows you to host declarative SwiftUI screens within legacy UIKit view controllers, facilitating incremental migration and gradual transitions to the modern UI framework.

How do I use UIViewRepresentable to integrate UIKit components like WKWebView in SwiftUI?

You use UIViewRepresentable to integrate UIKit components like WKWebView or MKMapView in SwiftUI by creating a wrapper struct. This pattern bridges the imperative UIKit view and its delegate handling into your declarative SwiftUI screen, enabling the use of UIKit-specific features.

Can I migrate a UIKit app to SwiftUI incrementally?

Yes, you can migrate a UIKit app to SwiftUI incrementally by using UIHostingController and representable protocols. This approach lets you rewrite individual parts of your application in SwiftUI while maintaining full compatibility with your existing UIKit foundation.

How do you bridge navigation and data flow between SwiftUI and UIKit?

Bridging navigation and data flow between SwiftUI and UIKit requires using UIHostingController and representable protocols to pass data across paradigms. This interoperability pattern connects the imperative UIKit navigation stack with the declarative SwiftUI state management.