Skip to content
Skills Library
Programming · Building & coding

swiftui-pro

/swiftui-pro

Use when writing, reviewing, or refactoring SwiftUI code — covers modern state management (@Observable), NavigationStack, layout, performance, and accessibility for iOS 26 / Swift 6.

Licence
MIT
Last repository change
18.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 18.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when writing, reviewing, or refactoring SwiftUI code — covers modern state management (@Observable), NavigationStack, layout, performance, and accessibility for iOS 26 / Swift 6.

Original author description

Use when writing, reviewing, or refactoring SwiftUI code — covers modern state management (@Observable), NavigationStack, layout, performance, and accessibility for iOS 26 / Swift 6.

How it works

  1. When to use
  2. Core principles
  3. State management
  4. Modifiers and styling
  5. Navigation
  6. Performance
  7. Async work
  8. Accessibility (always)
  9. Common mistakes checklist
  10. Output format (when reviewing)
Original SKILL.md headings · 141 lines, 548 words
SKILL.md preview
---
name: swiftui-pro
description: Use when writing, reviewing, or refactoring SwiftUI code — covers modern state management (@Observable), NavigationStack, layout, performance, and accessibility for iOS 26 / Swift 6.
license: MIT
metadata:
  author: Lax Rajpurohit
  version: "1.0.0"
---

# SwiftUI Pro

Write and review SwiftUI for correctness, modern APIs, and performance. Report real
problems only — no nitpicking.

## When to use

- Writing new SwiftUI views.
- Reviewing or refactoring existing SwiftUI.
- Fixing layout, state, navigation, or performance issues.

Trigger: `/swiftui-pro` or natural language ("review this SwiftUI view").

## Core principles

- Pure SwiftUI first — only drop to UIKit when the user explicitly needs it.
- Concurrency is structured async/await; no GCD unless there's a concrete reason.
- New dependencies are a conversation, not a default — ask before adding one.
- File hygiene: one declaration per file, grouped into folders by feature.
- Language/OS target follows the project; if unset, assume the current shipping
  Swift and SDK rather than legacy defaults.

## State management

Use `@Observable` (Observation framework), not `ObservableObject`/`@Published`.

❌ Legacy
```swift
final class CounterModel: ObservableObject {
    @Published var count = 0
}

struct CounterView: View {
    @StateObject private var model = CounterModel()
    var body: some View { Text("\(model.count)") }
}
```

✅ Modern
```swift
@Observable
final class CounterModel {
    var count = 0
}

struct CounterView: View {
    @State private var model = CounterModel()
    var body: some View { Text("\(model.count)") }
}
```

Rules:
- Own the model with `@State`. Pass it down plainly; use `@Bindable` only where you need
  two-way bindings to its properties.
- Use `@Environment` for app-wide models, not singletons.

## Modifiers and styling

- `foregroundStyle()` not `foregroundColor()`.
- `.background { ... }` / `.overlay { ... }` closure form, not deprecated overloads.
- Prefer `Grid`, `ViewThatFits`, and layout containers over manual `GeometryReader` math.

❌
```swift
Text("Hi").foregroundColor(.red)
```
✅
```swift
Text("Hi").foregroundStyle(.red)
```

## Navigation

Use `NavigationStack` with a typed path. `NavigationView` is deprecated.

❌
```swift
NavigationView {
    NavigationLink("Detail", destination: DetailView())
}
```
✅
```swift
NavigationStack(path: $path) {
    List(items) { item in
        NavigationLink(item.name, value: item.id)
    }
    .navigationDestination(for: Item.ID.self) { id in
        DetailView(id: id)
    }
}
```

## Performance

- Use `LazyVStack`/`LazyHStack` inside `ScrollView` for long content; plain `VStack`
  renders everything eagerly.
- Give `ForEach` stable identity (`Identifiable` or `id:`), never array indices for
  mutable collections.
- Keep `body` cheap. Move expensive work out of `body` into the model or `.task`.

❌ Index identity on a mutable list
```swift
ForEach(0..<items.count, id: \.self) { i in Row(items[i]) }
```
✅
```swift
ForEach(items) { item in Row(item) }
```

## Async work

Use `.task` (auto-cancelled on disappear), not `onAppear { Task { } }`.

✅
```swift
.task { await model.load() }
```

## Accessibility (always)

- Support Dynamic Type — avoid fixed font sizes; use semantic `.font(.body)` etc.
- Provide `.accessibilityLabel` for icon-only controls.
- Respect Reduce Motion for animations.

## Common mistakes checklist

- [ ] Using `ObservableObject`/`@Published` instead of `@Observable`.
- [ ] `foregroundColor` / `NavigationView` / other deprecated APIs.
- [ ] `VStack` where `LazyVStack` is needed.
- [ ] `ForEach` keyed by index on a mutable collection.
- [ ] Side effects or heavy compute in `body`.
- [ ] Icon-only buttons with no accessibility label.

## Output format (when reviewing)

Walk the code top to bottom. For each real problem give: the `file:line`, a one-line
statement of what's wrong, and a tight before → after snippet. Don't mention files that
are already fine. Close with the two or three fixes that matter most, in priority order.

Versions

RepositoryScoreLicence
This page · laxrajpurohit/swift-skills-pro100MIT
twostraws/swiftui-agent-skill100MIT
jacklandrin/OnlySwitch100MIT
aliemir/galley100MIT

Database snapshot: 13.11.2026 · package version ed06e6a03bca (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100ios-swiftui-architecture-and-state
    Production-grade iOS SwiftUI architecture, state management (@Observable, @State, @Binding, @Environment), Modern Swift Concurrency (async/await, Actors, Task Groups), NavigationStack routing, and Clean Architecture implementation patterns. Use when designing, building, or…
  • 100trove-swift
    Swift 6 and SwiftUI coding conventions for iOS development. Auto-activates when working with Swift files. Covers @Observable, async/await, NavigationStack, Swift Testing, and accessibility. Use when: swift conventions; swiftui view; swift testing.
  • 90neo-swift-ui
    Use this skill when building, debugging, refactoring, or reviewing SwiftUI apps or views for iOS 16+ and related Apple platforms. Trigger for NavigationStack, Observation/state flow, view composition, previews, performance, accessibility, and SwiftUI architecture.
  • 100swift-app-scaffold
    Use when starting a new iOS or macOS app, bootstrapping Package.swift, or scaffolding a modern SwiftUI architecture with Observation, SwiftData, NavigationStack, and Swift Testing.
  • 100swiftui-patterns
    SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices. Use when building or reviewing SwiftUI views, @Observable state, navigation, or render performance.
  • 100swiftui
    Expert SwiftUI assistance covering declarative iOS/macOS layouts, @Observable / ObservableObject state propagation, view modifiers, custom animations, and NavigationStack. Use when creating modern Apple platform user interfaces, widgets, and multi-platform apps.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.