Bridges UIKit and SwiftUI with representables, hosting controllers/configurations, coordinators, and shared observable state. Use for wrapping UIKit or third-party views/controllers, embedding SwiftUI in UIKit, system controller surfaces, or incremental UIKit-to-SwiftUI migration.
84%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Bridge UIKit and SwiftUI in both directions: wrap UIKit views and controllers for use in SwiftUI, embed SwiftUI views into existing UIKit view hierarchies, and coordinate state updates safely. Targets Swift 6.4 / iOS 26+.
UIViewRepresentable: Wraps a custom UIView (e.g., text views, maps, custom controls).UIViewControllerRepresentable: Wraps a UIViewController (e.g., camera controllers, document pickers, share sheets).UIHostingController: Embeds SwiftUI views into UIKit view controller hierarchies.UIHostingConfiguration: Embeds SwiftUI views directly into UICollectionView and UITableView cells (iOS 16+).makeCoordinator() ──> makeUIView(context:) ──> updateUIView(uiView, context:) ──> dismantleUIView(uiView, coordinator:)makeCoordinator(): Called once to create the delegate/coordinator object.makeUIView(context:): Called once to instantiate the UIKit view and assign delegates.updateUIView(_:context:): Called on every SwiftUI state change affecting the view. Must be idempotent.dismantleUIView(_:coordinator:): Cleanup point when the view leaves the hierarchy. Invalidate timers, unregister observers.[!WARNING] Prevent infinite update cycles: When UIKit notifies the coordinator of a change (e.g.,
textViewDidChange), the coordinator updates SwiftUI state via@Binding. This triggersupdateUIView. Always check for value equality before applying updates to the UIKit view:if uiView.text != text { uiView.text = text }
When adding a UIHostingController as a child view controller:
addChild(hostingController)view.addSubview(hostingController.view)hostingController.didMove(toParent: self)Use UIHostingConfiguration for modern cell layouts in UICollectionView/UITableView without manual controller management.
MKMapView, UITextView, and camera capture controllers, read Map, Text, and Camera Wrappers.PHPickerViewController, MFMailComposeViewController, UIActivityViewController, and search controllers, read Picker, Mail, Share, and Search Wrappers.PDFView, QLPreviewController, and MFMessageComposeViewController, read PDF and Message Wrappers.UIView default layout margins are zero. View controllers still provide systemMinimumLayoutMargins; set preservesSuperviewLayoutMargins to true to inherit them.UIMenuElement.preferredImageVisibility controls menu image visibility (images are hidden by default on iPadOS 27).UINavigationItem.navigationBarMinimization replaces barMinimizeBehavior and barMinimizationSafeAreaAdjustment. UIScrollEdgeElementContainerInteraction contributes a container view to the scroll edge effect shape. UISearchController center placement shows the scope bar inline.UIViewController.registerSceneAccessory(_:) with UISceneAccessory.externalNonInteractive.NSTextTable and related types are available to UIKit; UITextAttachmentViewProviderReusePolicy retains attachment views while scrolling.dragInteraction(_:sessionWillBegin:); use dragInteraction(_:sessionDidMove:).UIArrangementViewController, UIView.ReservedRegion, and UIHingeInteraction appeared in the September 2026 UIKit updates; check their availability annotations before use.Sources: https://sosumi.ai/documentation/ios-ipados-release-notes/ios-ipados-27-release-notes, https://sosumi.ai/documentation/updates/uikit
updateUIView instead of configuring the existing instance.updateUIView, triggering continuous render feedback loops.UIHostingController's view without calling addChild and didMove(toParent:).dismantleUIView.sizeThatFits) in custom representables.makeCoordinator used for delegates, target-actions, and data sourcesupdateUIView guards against redundant assignments to avoid feedback loopsaddChild, didMove) properly pairedUIHostingConfiguration where availabledismantleUIViewtranslatesAutoresizingMaskIntoConstraints = falsethienqo/ios-skills
6bf8b62
Canonical home
since May 23, 2026
Also appears in
on Oct 29, 2026
since May 28, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.