← ClaudeAtlas

swiftui-uikit-interoplisted

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.
dpearson2699/swift-ios-skills · ★ 730 · Data & Documents · score 80
Install: claude install-skill dpearson2699/swift-ios-skills
# SwiftUI-UIKit Interop Bridge UIKit and SwiftUI in both directions. Wrap UIKit views and view controllers for use in SwiftUI, embed SwiftUI views inside UIKit screens, and synchronize state across the boundary. Targets iOS 26+ with Swift 6.3 patterns; notes backward-compatible to iOS 16 unless stated otherwise. See [references/representable-recipes.md](references/representable-recipes.md) for complete wrapping recipes and [references/hosting-migration.md](references/hosting-migration.md) for UIKit-to-SwiftUI migration patterns. ## Contents - [UIViewRepresentable Protocol](#uiviewrepresentable-protocol) - [UIViewControllerRepresentable Protocol](#uiviewcontrollerrepresentable-protocol) - [The Coordinator Pattern](#the-coordinator-pattern) - [UIHostingController](#uihostingcontroller) - [Sizing and Layout](#sizing-and-layout) - [State Synchronization Patterns](#state-synchronization-patterns) - [Sendable Considerations](#sendable-considerations) - [Common Mistakes](#common-mistakes) - [Review Checklist](#review-checklist) - [References](#references) ## UIViewRepresentable Protocol Use `UIViewRepresentable` to wrap any `UIView` subclass for use in SwiftUI. ### Required Methods ```swift struct WrappedTextView: UIViewRepresentable { @Binding var text: String func makeUIView(context: Context) -> UITextView { // Called ONCE when SwiftUI inserts this view into the hierarchy. // Create and return the UIKit view. One-time setup goes here. let t