# swiftui-uikit-interop

Bridges UIKit and SwiftUI views, controllers, and shared state without lifecycle conflicts or duplicated data.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 4100 installs · ★ 1237
- Author: dpearson2699
- License: LicenseRef-Unknown · policy=link-only · description only; the file stays with the author
- Source: https://github.com/dpearson2699/swift-ios-skills/tree/HEAD/skills/swiftui-uikit-interop/SKILL.md
- Updated: 2026-07-31
- HTML: https://affpapa.org/en/nevibecode/skills/swiftui-uikit-interop

## What it does

The skill equips coding agents with integration patterns between UIKit and SwiftUI. It covers `UIViewRepresentable` and `UIViewControllerRepresentable` implementations, explicit handling of `updateUIView` cycles, and teardown logic inside `dismantleUIView`. Custom sizing with `sizeThatFits` is also covered for iOS 16 and later.

The coordinator pattern receives focused attention because value-type SwiftUI structs cannot act as UIKit delegates directly. Storing references on a dedicated coordinator class lets delegate callbacks safely mutate parent `@Binding` properties. Without defensive checks in view updates, two-way state synchronization easily triggers infinite rendering loops.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill swiftui-uikit-interop -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/swiftui-uikit-interop/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/swiftui-uikit-interop/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill swiftui-uikit-interop -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/swiftui-uikit-interop/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill swiftui-uikit-interop -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/swiftui-uikit-interop/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install dpearson2699/swift-ios-skills swiftui-uikit-interop
```

2. **Manually: put the files in place**
- File: `.github/skills/swiftui-uikit-interop/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill swiftui-uikit-interop -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/dpearson2699/swift-ios-skills --path skills/swiftui-uikit-interop
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/swiftui-uikit-interop/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill swiftui-uikit-interop -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/dpearson2699/swift-ios-skills/tree/HEAD/skills/swiftui-uikit-interop/SKILL.md

## When to use it
- wrap UIKit views in SwiftUI structs safely
- present system view controllers using UIViewControllerRepresentable
- route delegate callbacks back to SwiftUI bindings with a coordinator
- configure custom view dimensions with sizeThatFits on iOS 16+

## Example prompts
- Wrap UITextView in a UIViewRepresentable with a two-way text binding.
- Show how to present VNDocumentCameraViewController inside a SwiftUI sheet using a coordinator.
- Add dismantleUIView to clean up active observers and subscriptions when the view leaves the hierarchy.

## Similar
- [axiom-uikit](https://affpapa.org/en/nevibecode/skills/axiom-uikit.md) — skill · 1200 installs
- [uikit](https://affpapa.org/en/nevibecode/skills/uikit.md) — skill · 455 installs
- [uikit-max](https://affpapa.org/en/nevibecode/skills/uikit-max.md) — skill · 736 installs
- [uikit-app-modernization](https://affpapa.org/en/nevibecode/skills/uikit-app-modernization.md) — skill · 689 installs
- [iphone-duo-readiness](https://affpapa.org/en/nevibecode/skills/iphone-duo-readiness.md) — skill · 630 installs
- [swiftui-patterns](https://affpapa.org/en/nevibecode/skills/affaan-m-swiftui-patterns.md) — skill · 4600 installs

From the same set: [dpearson2699/swift-ios-skills](https://affpapa.org/en/nevibecode/by/dpearson2699/swift-ios-skills.md) — 86 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
