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.
Detected risks:
The swiftui-uikit-interop skill helps developers bridge UIKit and SwiftUI in both directions, enabling incremental adoption of SwiftUI while continuing to use existing UIKit components. It addresses common integration challenges by providing patterns for wrapping UIKit views and view controllers so they can be used inside SwiftUI, as well as embedding SwiftUI views within UIKit-based applications. The skill focuses on state synchronization, lifecycle management, layout behavior, and communication across framework boundaries.
Its core capabilities include using UIViewRepresentable to expose UIKit views to SwiftUI, using UIViewControllerRepresentable to integrate UIKit view controllers, embedding SwiftUI content in UIKit through UIHostingController, and coordinating delegate-driven communication with the Coordinator pattern. The documentation also covers representable lifecycle methods such as makeUIView, updateUIView, makeCoordinator, dismantleUIView, and sizeThatFits, along with guidance for state synchronization, sizing and layout, Sendable considerations, common mistakes, review checklists, and migration patterns.
This skill is intended for iOS developers working with SwiftUI and UIKit applications. Typical use cases include integrating camera previews, map views, mail composition interfaces, document scanners, PDF rendering components, attributed-text editors, and third-party UIKit SDKs that do not have native SwiftUI equivalents. It is also useful for teams migrating large UIKit codebases to SwiftUI incrementally while maintaining compatibility with existing screens and architecture.
Use UIViewRepresentable when you need to wrap a UIKit UIView subclass so it can be displayed and managed within a SwiftUI view hierarchy.
The skill covers embedding SwiftUI views in UIKit using UIHostingController, allowing SwiftUI screens to be integrated into existing UIKit-based apps.
The Coordinator pattern is used to manage delegate and datasource communication, helping synchronize events and state between UIKit components and SwiftUI.
The documentation targets iOS 26+ with Swift 6.3 patterns and includes notes that are backward-compatible to iOS 16 unless otherwise specified.
Important lifecycle methods include makeCoordinator(), makeUIView(context:), updateUIView(_:context:), dismantleUIView(_:coordinator:), and sizeThatFits(_:uiView:context:) where supported.
Quick Setup:
.claude/skills/Repository
dpearson2699/swift-ios-skills