swiftui-uikit-interop

Installation
Summary

Wrap UIKit views and controllers in SwiftUI, embed SwiftUI in UIKit, and synchronize state across both frameworks.

  • Use UIViewRepresentable to wrap UIKit views (text views, map views, web views) and UIViewControllerRepresentable for modal controllers (document scanners, mail compose, pickers); both rely on the Coordinator pattern to bridge delegate callbacks
  • Embed SwiftUI views inside UIKit with UIHostingController using proper child containment (addChild, add view, didMove), or use UIHostingConfiguration for collection/table cells (iOS 16+)
  • Synchronize state via @Binding for two-way sync, closures for one-way events, and environment values for theme/accessibility changes; guard against update loops by checking before reassigning UIKit properties
  • Set delegates and create views once in makeUIView/makeUIViewController, never in updateUIView; clean up observers and timers in dismantleUIView to prevent leaks and stale callbacks
SKILL.md

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 for complete wrapping recipes and references/hosting-migration.md for UIKit-to-SwiftUI migration patterns.

Contents

Related skills

More from dpearson2699/swift-ios-skills

Installs
1.5K
GitHub Stars
562
First Seen
Mar 3, 2026