Agent skill

swiftui-uikit-interop

Bridges UIKit and SwiftUI with UIViewRepresentable, UIViewControllerRepresentable, UIHostingController, UIHostingConfiguration, coordinator delegates, and UIKit automatic observation tracking for shared @Observable state. Use when wrapping UIKit-only or third-party UIKit views/controllers in SwiftUI, embedding SwiftUI in UIKit, integrating mail/share/document/PDF/text-view surfaces, or migrating UIKit apps to SwiftUI incrementally.

Derek Pearson935★ · +23/wk · 1 repos on radarProfile →
claude-codecodexcursorNOASSERTION
Install
npx skills add dpearson2699/swift-ios-skills --skill swiftui-uikit-interop --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 4
SKILL.md size: 18 KB
Bundled scripts: none
Path: skills/swiftui-uikit-interop/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 963 · +28 this week
Language: Python
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

Bridges UIKit and SwiftUI in both directions: wrap UIKit views and controllers, embed SwiftUI in UIKit screens, and synchronize state without duplicating lifecycle ownership.

How it works

  • Provides wrappers using UIViewRepresentable and UIViewControllerRepresentable to expose UIKit views and view controllers to SwiftUI.
  • Uses a Coordinator class to handle UIKit delegation and callbacks, routing results back to SwiftUI via @Binding or closures.
  • Demonstrates embedding SwiftUI content inside UIKit with UIHostingController, including the three-step containment sequence (addChild, add view, didMove).
  • Shows how to set up UIHostingConfiguration for cell content in collection/table views and how to manage sizing via sizingOptions and intrinsic content size.
  • Explains state synchronization patterns: two-way with @Binding, one-way events with closures, and environment access within representable methods.
  • Details UIKit Automatic Observation Tracking considerations and Sendable guidance for coordinators.

When to use it

Use when wrapping UIKit-only or third-party UIKit views/controllers in SwiftUI, embedding SwiftUI in UIKit, integrating mail/share/document/PDF/text-view surfaces, or migrating UIKit apps to SwiftUI incrementally.

What it can touch

  • Uses UIViewRepresentable, UIViewControllerRepresentable, UIHostingController, UIHostingConfiguration, and a Coordinator class to bridge between SwiftUI and UIKit.
  • Demonstrates interaction with @Binding, closures, and @Observable state tracking.

Caveats

  • Advises on proper lifecycle handling (e.g., set delegates in makeUIView/makeUIViewController, guard against update loops).
  • Notes platform/version constraints (iOS 16+ sizeThatFits and UIHostingConfiguration; iOS 26+ updateProperties; iOS 18 Info.plist requirement for UIKit tracking; iOS 17 limitations on @Observable).
  • Discusses concurrency guidance for coordinators (e.g., @MainActor).
From the SKILL.md

# SwiftUI-UIKit Interop Bridge UIKit and SwiftUI in both directions: wrap UIKit views and controllers, embed SwiftUI in UIKit screens, and synchronize state without duplicating lifecycle ownership. 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) - [UIKit Automatic Observation Tracking](#uikit-automatic-observation-tracking) - [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: UIViewRep

What's inside
Steps it walks through
  1. Contents
  2. UIViewRepresentable Protocol
  3. Required Methods
  4. Lifecycle Timing
  5. Optional: dismantleUIView
  6. Optional: sizeThatFits (iOS 16+)
  7. UIViewControllerRepresentable Protocol
  8. Handling Results from Presented Controllers
  9. The Coordinator Pattern
  10. Why Coordinators Exist
  11. Structure
  12. Key Rules
  13. UIHostingController
  14. Basic Embedding
Ships with 3 files
  • evals/evals.json
  • references/hosting-migration.md
  • references/representable-recipes.md
More from swift-ios-skills
All skills →
About this skill
What does the swiftui-uikit-interop skill do?

Bridges UIKit and SwiftUI with UIViewRepresentable, UIViewControllerRepresentable, UIHostingController, UIHostingConfiguration, coordinator delegates, and UIKit automatic observation tracking for shared @Observable state. Use when wrapping UIKit-only or third-party UIKit views/controllers in SwiftUI, embedding SwiftUI in UIKit, integrating mail/share/document/PDF/text-view surfaces, or migrating UIKit apps to SwiftUI incrementally.

How do I install it?

Run `npx skills add dpearson2699/swift-ios-skills --skill swiftui-uikit-interop --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From dpearson2699/swift-ios-skills, a repository with 963 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going