home / skills / beshkenadze / claude-skills-marketplace / ios-swiftui-generator

ios-swiftui-generator skill

/skills/development/ios-swiftui-generator

This skill generates production-ready SwiftUI components that follow Apple HIG, ensuring semantic colors, SF Symbols, accessibility, and dark mode support.

npx playbooks add skill beshkenadze/claude-skills-marketplace --skill ios-swiftui-generator

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
3.0 KB
---
name: ios-swiftui-generator
description: Generate SwiftUI components following Apple HIG. Use when creating iOS UI components, building SwiftUI views, or need code scaffolding for iOS interfaces.
version: 1.0.0
---

# iOS SwiftUI Generator

Generate production-ready SwiftUI code following Apple Human Interface Guidelines.

## When to Use

- Creating new SwiftUI views or components
- Building iOS UI from design descriptions
- Need HIG-compliant code scaffolding
- Converting UI concepts to SwiftUI code

## Generation Principles

### Always Follow

1. **Semantic Colors** — Use `Color.primary`, `Color(.systemBackground)`, not hex
2. **SF Symbols** — Prefer system icons over custom assets
3. **Dynamic Type** — Support text scaling with `.font(.body)`
4. **Dark Mode** — All colors must work in both modes
5. **Accessibility** — Include VoiceOver labels, minimum 44pt touch targets

### Code Standards

```swift
// ✅ Good
struct ExpenseCard: View {
    let expense: Expense

    var body: some View {
        HStack {
            Image(systemName: expense.category.icon)
                .foregroundStyle(.secondary)
                .accessibilityHidden(true)

            VStack(alignment: .leading) {
                Text(expense.title)
                    .font(.headline)
                Text(expense.date, style: .date)
                    .font(.subheadline)
                    .foregroundStyle(.secondary)
            }

            Spacer()

            Text(expense.amount, format: .currency(code: "USD"))
                .font(.headline)
        }
        .padding()
        .background(Color(.secondarySystemBackground))
        .clipShape(RoundedRectangle(cornerRadius: 12))
        .accessibilityElement(children: .combine)
        .accessibilityLabel("\(expense.title), \(expense.amount)")
    }
}

// ❌ Bad
struct ExpenseCard: View {
    var body: some View {
        HStack {
            Image("custom-icon")  // Use SF Symbols
            Text("$50.00")
                .foregroundColor(Color(hex: "#333"))  // Use semantic
        }
        .frame(height: 30)  // Too small for touch
    }
}
```

## Component Templates

### Navigation
- Tab Bar (2-5 items)
- Navigation Stack with drill-down
- Modal sheets and full-screen covers
- Search integration

### Forms
- Text fields with validation
- Pickers (date, selection, wheel)
- Toggles and steppers
- Secure fields

### Lists
- Standard list with sections
- Swipe actions
- Pull-to-refresh
- Empty states

### Cards & Containers
- Content cards
- Grouped backgrounds
- Material overlays

## Usage

```
User: Create a settings screen with profile section and preferences

Claude: [Generates SwiftUI code]
- SettingsView with List and sections
- ProfileHeaderView component
- PreferenceRow reusable component
- All using semantic colors and SF Symbols
```

## Output Format

Generated code includes:
1. Main view struct
2. Supporting subviews
3. Preview provider
4. Accessibility labels
5. Usage comments

## Related Skills

- `ios-design-review` — Validate generated code
- `ios-hig-reference` — Design guidelines reference

Overview

This skill generates production-ready SwiftUI components that follow Apple Human Interface Guidelines. It creates HIG-compliant views, supporting subviews, previews, and accessibility metadata to jumpstart iOS UI development. The output is ready to drop into an Xcode project and emphasizes semantic colors, SF Symbols, Dynamic Type, and Dark Mode support.

How this skill works

Provide a UI description or design intent and the skill generates a main SwiftUI view plus supporting subviews and a PreviewProvider. It enforces generation principles: semantic colors, SF Symbols, accessibility labels, minimum touch sizes, and adaptive typography. The produced code includes comments, example state, and usage notes for integration.

When to use it

  • Creating new SwiftUI screens or reusable components
  • Translating design specs or wireframes into SwiftUI code
  • Scaffolding views that must meet Apple HIG and accessibility standards
  • Converting UI concepts into production-ready, Xcode-ready files
  • Prototyping app flows with NavigationStack, tabs, sheets, or lists

Best practices

  • Use semantic Color and system materials instead of hard-coded hex values
  • Prefer SF Symbols and mark decorative images as accessibilityHidden
  • Ensure text uses scalable fonts (e.g., .font(.body), .headline) for Dynamic Type
  • Provide accessibilityLabel, accessibilityValue, and combine child elements for complex controls
  • Keep interactive elements at least 44x44 points and test in both light and dark appearances
  • Include PreviewProvider examples with multiple states and accessibility inspection

Example use cases

  • Settings screen with profile header, grouped preferences, and toggles using semantic colors
  • Master-detail flow built with NavigationStack and searchable lists
  • Card-based expense row with SF Symbol icons, formatted currency, and VoiceOver labels
  • Form with validated text fields, secure input, date picker, and inline validation messages
  • List with sections, swipe actions, pull-to-refresh, and an empty state view

FAQ

Will the generated code run in Xcode previews?

Yes. Each output includes a PreviewProvider with example states so you can view and iterate in Xcode previews immediately.

How does the skill handle accessibility?

Accessibility is enforced by default: VoiceOver labels, combined accessibility elements for compound views, minimum touch targets, and marking decorative images as hidden.