swiftui-uikit-interop

Wrap UIKit views and controllers in SwiftUI with representable and hosting patterns.

981|50|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/dpearson2699/swift-ios-skills --skill swiftui-uikit-interop-dpearson2699
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftui-uikit-interop
Source: https://github.com/dpearson2699/swift-ios-skills/tree/main/skills/swiftui-uikit-interop
Command: npx skills add https://github.com/dpearson2699/swift-ios-skills --skill swiftui-uikit-interop-dpearson2699

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 existing UIKit components into SwiftUI apps and vice-versa, facilitating incremental migrations and leveraging platform-specific features.

Core Features & Use Cases

  • Wrap UIKit in SwiftUI: Use UIViewRepresentable and UIViewControllerRepresentable to embed UIKit views and controllers (like WKWebView, MKMapView, UITextView, PHPickerViewController) within SwiftUI views.
  • Embed SwiftUI in UIKit: Use UIHostingController to present SwiftUI views from within UIKit view controllers.
  • Coordinator Pattern: Manage delegate patterns and data flow across the SwiftUI-UIKit boundary.
  • Use Case: Integrate a complex UIKit-based camera preview into a new SwiftUI application, or incrementally migrate a large UIKit app by replacing individual screens with SwiftUI views wrapped in UIHostingController.

Quick Start

Wrap a UIKit UITextView in SwiftUI using UIViewRepresentable by defining makeUIView and updateUIView methods.

Frequently Asked Questions about swiftui-uikit-interop

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

FAQPage Schema
How do I use a UIKit view in SwiftUI?

To use a UIKit view in SwiftUI, you wrap it using the `UIViewRepresentable` protocol and implement the `makeUIView` and `updateUIView` methods to manage the view's lifecycle and state updates.

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

Embedding SwiftUI views in a UIKit app is done using `UIHostingController`, which allows you to present SwiftUI views from within existing UIKit view controllers for incremental migrations.

How does the Coordinator pattern work for UIKit and SwiftUI interoperability?

The Coordinator pattern manages delegate patterns and data flow across the SwiftUI-UIKit boundary by acting as an intermediary to synchronize state between your wrapped UIKit components and SwiftUI views.

Can I use a UIViewController in SwiftUI?

Yes, you can use a UIViewController in SwiftUI by wrapping it with the `UIViewControllerRepresentable` protocol to embed complex controllers like `PHPickerViewController` within SwiftUI views.

Why migrate a UIKit app to SwiftUI incrementally?

Migrating incrementally allows you to leverage platform-specific features by wrapping individual UIKit screens in `UIHostingController` or embedding specific UIKit components, avoiding a full rewrite.