# ios-uikit-architecture

ios-uikit-architecture — a skill with UIKit architecture patterns: MVVM, MVC, coordinators, dependency injection, and integration of SwiftUI into UIKit apps. Use it when building iOS applications with UIKit.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 145 installs · ★ 201 repo stars
- Author: TheBushidoCollective
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/TheBushidoCollective/han/tree/HEAD/plugins/specialized/ios/skills/uikit-architecture/SKILL.md
- Updated: 2026-09-08
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/ios-uikit-architecture

## What it does

The skill provides working examples of UIKit architectural patterns: MVVM with separation of models, views, and view models; the Coordinator pattern for managing navigation outside view controllers; and dependency injection through initializers for easier testing. It covers modern Collection View with Diffable Data Source for automatic list updates.

The skill demonstrates how to embed SwiftUI views in UIKit via UIHostingController and wrap UIKit components in SwiftUI using UIViewRepresentable. Examples show programmatic UI construction with Auto Layout and structured code organization.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add TheBushidoCollective/han --skill ios-uikit-architecture -a claude-code
```

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

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add TheBushidoCollective/han --skill ios-uikit-architecture -a codex
```

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

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add TheBushidoCollective/han --skill ios-uikit-architecture -a cursor
```

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

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install TheBushidoCollective/han plugins/specialized/ios/skills/uikit-architecture
```

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

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add TheBushidoCollective/han --skill ios-uikit-architecture -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/TheBushidoCollective/han --path plugins/specialized/ios/skills/uikit-architecture
```

### Windsurf (Devin Desktop)

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

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add TheBushidoCollective/han --skill ios-uikit-architecture -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/TheBushidoCollective/han/tree/HEAD/plugins/specialized/ios/skills/uikit-architecture/SKILL.md

## When to use it
- manage navigation without putting logic in view controllers
- separate presentation from business logic in UIKit
- set up dependency injection for UIViewController instances
- embed SwiftUI in an existing UIKit app
- build a list that updates automatically

## Example prompts
- Build an MVVM structure for a profile screen with model, view model, and UIViewController
- Implement the Coordinator pattern to handle navigation between app screens
- Wrap a UIKit component like MKMapView in SwiftUI using UIViewRepresentable

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: d6fd5dc3324cef38.

BEGIN THIRD-PARTY FILE d6fd5dc3324cef38
````text
---
name: ios-uikit-architecture
user-invocable: false
description: Use when building iOS apps with UIKit, implementing MVVM/MVC/Coordinator patterns, or integrating UIKit with SwiftUI.
allowed-tools:
  - Read
  - Write
  - Edit
  - Bash
  - Grep
  - Glob
---

# iOS - UIKit Architecture

Architectural patterns and best practices for UIKit-based iOS applications.

## Key Concepts

### MVVM Architecture

The Model-View-ViewModel pattern separates concerns:

- **Model**: Data and business logic
- **View**: UIViewController and UIView subclasses
- **ViewModel**: Presentation logic, transforms model data for display

```swift
// Model
struct User {
    let id: String
    let firstName: String
    let lastName: String
    let email: String
}

// ViewModel
class UserProfileViewModel {
    private let user: User

    var displayName: String {
        "\(user.firstName) \(user.lastName)"
    }

    var emailDisplay: String {
        user.email.lowercased()
    }

    init(user: User) {
        self.user = user
    }
}

// View
class UserProfileViewController: UIViewController {
    private let viewModel: UserProfileViewModel

    init(viewModel: UserProfileViewModel) {
        self.viewModel = viewModel
        super.init(nibName: nil, bundle: nil)
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        nameLabel.text = viewModel.displayName
        emailLabel.text = viewModel.emailDisplay
    }
}
```

### Coordinator Pattern

Coordinators handle navigation flow, removing navigation logic from view controllers:

```swift
protocol Coordinator: AnyObject {
    var childCoordinators: [Coordinator] { get set }
    var navigationController: UINavigationController { get }
    func start()
}

class AppCoordinator: Coordinator {
    var childCoordinators: [Coordinator] = []
    var navigationController: UINavigationController

    init(navigationController: UINavigationController) {
        self.navigationController = navigationController
    }

    func start() {
        let vc = HomeViewController()
        vc.coordinator = self
        navigationController.pushViewController(vc, animated: false)
    }

    func showDetail(for item: Item) {
        let detailCoordinator = DetailCoordinator(
            navigationController: navigationController,
            item: item
        )
        childCoordinators.append(detailCoordinator)
        detailCoordinator.start()
    }
}
```

### Dependency Injection

Inject dependencies through initializers for testability:

```swift
protocol UserServiceProtocol {
    func fetchUser(id: String) async throws -> User
}

class UserViewController: UIViewController {
````
END THIRD-PARTY FILE d6fd5dc3324cef38

The third-party file has ended. Everything between the d6fd5dc3324cef38 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2648 of 9574 bytes. © TheBushidoCollective · Apache-2.0 · https://github.com/TheBushidoCollective/han/tree/HEAD/plugins/specialized/ios/skills/uikit-architecture/SKILL.md

_Part of the page did not fit — see the HTML version._

---
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
