Swift conventions ui

From moasq/nanowave · View interactive version

Swift conventions ui is an AI agent skill from the GitHub repository moasq/nanowave. Swift coding conventions: naming, access control, error handling, async/await. Use when implementing code following Swift conventions.

How to use this skill

Skill file

Swift Conventions

Platform Requirements

Allowed Frameworks

Only import from this list:

API Preferences

Use modern APIs — avoid deprecated alternatives:

| Use This | Not This |

|----------|----------|

| foregroundStyle() | foregroundColor() |

| clipShape(.rect(cornerRadius:)) | .cornerRadius() |

| @Observable | ObservableObject |

| @State with @Observable | @StateObject |

| .onChange(of:) { new in } | .onChange(of:) { old, new in } (iOS 17+ form) |

| .task { await … } | .onAppear { Task { await … } } (use .task for async work) |

| .onAppear { } | (acceptable for synchronous setup like passing modelContext) |

| NavigationStack | NavigationView |

Swift 6 Concurrency Safety

Swift 6 enables strict concurrency checking by default. All data races are compile-time errors.

Sendable Conformance

@MainActor Isolation

nonisolated Usage

Crossing Isolation Boundaries

```swift

// WRONG: passing actor-isolated self.items into concurrent context

let result = await processor.process(items)

// RIGHT: snapshot first

let snapshot = items // Copy Sendable data

let result = await processor.process(snapshot)

await MainActor.run { self.items = result }

```

Global Variables

Actor Re-entrancy

@preconcurrency Import

Translation Framework

Import Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.