swiftui-uikit-interop

Bridge UIKit and SwiftUI with representable wrappers and UIHostingController.

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

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 with SwiftUI wrappers, enables embedding SwiftUI in UIKit screens via UIHostingController, and coordinates delegate callbacks to synchronize state across boundaries.

Core Features & Use Cases

  • Wrap UIKit components as SwiftUI views using UIViewRepresentable and UIViewControllerRepresentable.
  • Embed SwiftUI inside UIKit using UIHostingController and coordinate data flow with Coordinators.
  • Use for integrating camera previews, maps, document pickers, text views with attributed text, or migrating UIKit apps to SwiftUI incrementally.

Quick Start

Create a UIViewRepresentable wrapper for your UIKit view and start using it inside SwiftUI immediately.

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 UIKit views in SwiftUI using UIViewRepresentable?

Wrap UIKit views in SwiftUI by creating a UIViewRepresentable struct, implementing makeUIView and updateUIView methods, and managing UIKit delegate callbacks via a Coordinator to synchronize state across boundaries.

What's the best way to embed SwiftUI inside a UIKit app?

Embed SwiftUI inside UIKit screens by initializing a UIHostingController with your SwiftUI view, then adding it as a child view controller to coordinate data flow and state synchronization across the UIKit and SwiftUI boundaries.

Can I migrate a UIKit app to SwiftUI incrementally?

Migrate UIKit apps to SwiftUI incrementally by wrapping individual UIKit surfaces like camera, maps, document pickers, and text editors with representable wrappers, ensuring safe and predictable interoperation during the transition.

How does Coordinator-based delegation work for UIKit and SwiftUI interop?

Coordinator-based delegation assigns a Coordinator class to handle UIKit view delegate callbacks, intercepting events and synchronizing state updates across the UIKit and SwiftUI boundaries for predictable integration.

Does UIHostingController support environment bridging for SwiftUI views?

UIHostingController supports environment bridging by passing SwiftUI environment values to hosted views, ensuring consistent state and contextual data flow when embedding SwiftUI components inside UIKit view controllers.

Why does my UIViewRepresentable wrapper fail to update SwiftUI state?

UIViewRepresentable wrappers fail to update SwiftUI state when delegate callbacks are not routed through the Coordinator, breaking the state synchronization bridge between the UIKit view and the SwiftUI interface.