swiftui-uikit-interop

Bridge UIKit and SwiftUI with representable wrappers and UIHostingController.

Updated Apr 19, 2026
One-click install
npx skills add https://github.com/femitz/flyby --skill swiftui-uikit-interop-femitz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftui-uikit-interop
Source: https://github.com/femitz/flyby/tree/main/.agents/skills/swiftui-uikit-interop
Command: npx skills add https://github.com/femitz/flyby --skill swiftui-uikit-interop-femitz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Bridges UIKit and SwiftUI by wrapping UIKit views and view controllers in SwiftUI with UIViewRepresentable and UIViewControllerRepresentable, embedding SwiftUI in UIKit with UIHostingController, and coordinating delegate callbacks. Use when integrating camera previews, map views, mail compose, document scanners, PDF renderers, text views with attributed text, or other UIKit-only or third-party UIKit SDK surfaces into a SwiftUI app, or when migrating a UIKit app to SwiftUI incrementally.

Core Features & Use Cases

  • Wrap UIKit views with UIViewRepresentable for use in SwiftUI.
  • Wrap UIKit view controllers with UIViewControllerRepresentable for modal and navigation flows.
  • Embed SwiftUI inside UIKit using UIHostingController and coordinate delegates with a Coordinator.
  • Use Case: incremental migration of a UIKit app to SwiftUI while preserving behavior and state.

Quick Start

Create a SwiftUI wrapper by implementing UIViewRepresentable for your UIKit view and embed SwiftUI in UIKit with UIHostingController, wiring a Coordinator to handle delegate callbacks.

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 inside a SwiftUI app?

To use a UIKit view inside SwiftUI, wrap it with UIViewRepresentable. This protocol requires implementing makeUIView and updateUIView methods to create and configure the UIKit component within the SwiftUI layout.

How do I embed SwiftUI views inside an existing UIKit view controller?

Embed SwiftUI views inside UIKit using UIHostingController. This controller manages a SwiftUI view hierarchy and can be presented or pushed within standard UIKit navigation and modal flows.

How does the Coordinator pattern work with UIViewControllerRepresentable in SwiftUI?

The Coordinator pattern in UIViewControllerRepresentable acts as a delegate bridge. It handles UIKit delegate callbacks and communicates events back to SwiftUI, ensuring cross-framework state synchronization.

What is the best way to incrementally migrate a UIKit app to SwiftUI?

Incremental UIKit to SwiftUI migration is best achieved by embedding SwiftUI with UIHostingController while wrapping remaining UIKit components. This preserves existing behavior and state during the transition.

Can I integrate camera previews or map views into SwiftUI using UIKit interop?

Yes, you can integrate camera previews, map views, and document scanners into SwiftUI. Wrap these UIKit-only components using UIViewRepresentable or UIViewControllerRepresentable for seamless interop.

Why do I need UIViewControllerRepresentable for modal flows in SwiftUI?

UIViewControllerRepresentable is needed for modal and navigation flows in SwiftUI because it wraps complex UIKit view controllers. It manages delegate coordination that standard SwiftUI views cannot handle directly.