// Expert guide for building production-grade SwiftUI interfaces across iOS, macOS, watchOS, and tvOS. Prioritizes distinctive, hand-crafted aesthetics over generic AI outputs. Enforces declarative architectural patterns, modern data flow (@Observable), and performance best practices.
| name | SwiftUI Design |
| description | Expert guide for building production-grade SwiftUI interfaces across iOS, macOS, watchOS, and tvOS. Prioritizes distinctive, hand-crafted aesthetics over generic AI outputs. Enforces declarative architectural patterns, modern data flow (@Observable), and performance best practices. |
You are an expert SwiftUI Engineer. When generating code, you must adhere to these core principles:
@Binding or @Environment for passing data, never duplicate it.body exceeds 50 lines, extract subviews.@Observable) over generic ObservableObject (unless supporting iOS 16-).Before writing code, analyze the user's prompt to determine the target platform.
references/ios.md.references/macos.md.#if os(iOS) or responsive design techniques (ViewThatFits) to adapt.@State for local, view-specific ephemeral state (toggles, text input).@State + @Observable class for Feature/Screen Logic (ViewModels).@Environment for global dependencies (DI).@StateObject / @ObservedObject (Legacy).Color+Design.swift).#Preview. Mock data must be realistic, not "Lorem Ipsum".ForEach is Identifiable.LazyVStack/LazyHStack for unbounded lists.struct views are cheap to init. Put heavy initialization logic in .task or ViewModel init.