swiftship/internal/skills/data/ui/swift-conventions-ui/SKILL.md
Swift coding conventions: naming, access control, error handling, async/await. Use when implementing code following Swift conventions.
npx skillsauth add abdullah4ai/apple-dev-docs swift-conventionsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Only import from this list:
SwiftUIFoundationSwiftDataObservationOSLog (for logging)UIKit (only for required bridges or APIs without a SwiftUI equivalent)PhotosUI (only when the app requires photo picking)AVFoundation (only when the app requires audio/video)MapKit (only when the app requires maps)CoreLocation (only when the app requires location)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 enables strict concurrency checking by default. All data races are compile-time errors.
Sendable.final and have only immutable (let) Sendable stored properties, OR be marked @unchecked Sendable with manual thread safety (mutex/lock).@Sendable — they cannot capture mutable local state.@Published or @Observable state MUST be annotated @MainActor.@MainActor.@MainActor, so @State var vm: SomeViewModel works if SomeViewModel is @MainActor.@MainActor on the class/actor declaration, not on individual methods — partial isolation causes confusing errors.nonisolated.Hashable.hash(into:), CustomStringConvertible.description) on @MainActor types must be nonisolated.nonisolated(unsafe) only as a last resort for legacy API bridging.@MainActor-isolated values directly into APIs that execute in @concurrent contexts.MainActor for state updates:
// 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 }
sending parameter keyword marks closure parameters that cross isolation boundaries — use it when writing APIs that accept callbacks from different isolation domains.static let for shared constants — static var is a mutable global and violates strict concurrency.actor or @MainActor-isolated type.AppIntent static properties (title, description) MUST be static let.await inside an actor.@preconcurrency import FrameworkName for frameworks not yet annotated for Sendable (e.g., some older Apple frameworks)..translationTask { session in ... } flows, do NOT call session.translate(...) inside @MainActor-isolated methods.@MainActor only for UI state updates.import statementSwiftUI in a model file that only needs FoundationSwiftUI and UIKit when needed for framework types or platform bridges, but must not declare Views/UIViewControllerstools
Apple platform skill for docs, WWDC lookup, App Store Connect work, and SwiftUI app generation. Use repo-local `node cli.js` for Apple docs and WWDC search, `appledev store` for App Store Connect workflows, and `appledev build` for app scaffolding or fix loops on macOS. USE WHEN: Apple APIs, WWDC sessions, TestFlight/App Store tasks, or building/fixing Apple-platform apps. DON'T USE WHEN: non-Apple platforms, generic backend work, or general web research. EDGE CASES: docs-only queries use `node cli.js` in this repo, not `appledev`; release workflows use `appledev store`; app scaffolding uses `appledev build`; rules-only requests can read `references/ios-rules/` or `references/swiftui-guides/` progressively without invoking binaries.
tools
All-in-one Apple developer skill with three integrated tools shipped as a single unified binary. (1) Documentation search across Apple frameworks, symbols, and 1,267 WWDC sessions from 2014-2025. No credentials needed. (2) App Store Connect CLI with 120+ commands covering builds (find/wait/upload), TestFlight, pre-submission validate, submissions, signing, subscriptions (family-sharable), IAP, analytics, Xcode Cloud, metadata workflows, release pipeline dashboard, insights, win-back offers, promoted purchases, product pages, nominations, accessibility declarations, pre-orders, pricing filters, localizations update, diff, webhooks with local receiver, workflow automation, and more. Requires App Store Connect API key. (3) Multi-platform app builder (iOS/watchOS/tvOS/iPad/macOS/visionOS) that generates complete Swift/SwiftUI apps from natural language with auto-fix, simulator launch, interactive chat mode, and open-in-Xcode. Requires an LLM API key and Xcode. Includes 38 iOS development rules and 12 SwiftUI best practice guides for Liquid Glass, navigation, state management, and modern APIs. All three tools ship as one binary (appledev). USE WHEN: Apple API docs, App Store Connect management, WWDC lookup, or building iOS/watchOS/tvOS/macOS/visionOS apps from scratch. DON'T USE WHEN: non-Apple platforms or general coding.
testing
watchOS complications: WidgetKit complication families, accessory sizes, timeline providers for watch face. Use when implementing watchOS-specific patterns related to widgets.
development
watchOS haptic feedback: WKInterfaceDevice preset haptic types for wrist-based feedback. Use when implementing watchOS-specific patterns related to haptics.