Modern SwiftUI architecture patterns covering @Observable state management, view composition, type-safe NavigationStack flows, and rendering performance. USE WHEN building SwiftUI views, choosing between @State, @Binding, and @Observable, designing navigation or view models, or optimizing list and layout performance.
Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.
Quelldateien prüfen
Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
Modern SwiftUI architecture patterns covering @Observable state management, view composition, type-safe NavigationStack flows, and rendering performance. USE WHEN building SwiftUI views, choosing between @State, @Binding, and @Observable, designing navigation or view models, or optimizing list and layout performance.
cluster
native-ios
version
1.0.0
SwiftUI Patterns
Modern SwiftUI patterns for building declarative, performant user interfaces on Apple platforms. Covers the Observation framework, view composition, type-safe navigation, and performance optimization.
When to Activate
Building SwiftUI views and managing state (@State, @Observable, @Binding)
Designing navigation flows with NavigationStack
Structuring view models and data flow
Optimizing rendering performance for lists and complex layouts
Working with environment values and dependency injection in SwiftUI
State Management
Property Wrapper Selection
Choose the simplest wrapper that fits:
Wrapper
Use Case
@State
View-local value types (toggles, form fields, sheet presentation)
@Binding
Two-way reference to parent's @State
@Observable class + @State
Owned model with multiple properties
@Observable class (no wrapper)
Read-only reference passed from parent
@Bindable
Two-way binding to an @Observable property
@Environment
Shared dependencies injected via .environment()
@Observable ViewModel
Use @Observable (not ObservableObject) — it tracks property-level changes so SwiftUI only re-renders views that read the changed property:
Using ObservableObject / @Published / @StateObject / @EnvironmentObject in new code — migrate to @Observable
Putting async work directly in body or init — use .task {} or explicit load methods
Creating view models as @State inside child views that don't own the data — pass from parent instead
Using AnyView type erasure — prefer @ViewBuilder or Group for conditional views
Ignoring Sendable requirements when passing data to/from actors
References
See skill: swift-actor-persistence for actor-based persistence patterns.
See skill: swift-protocol-di-testing for protocol-based DI and testing with Swift Testing.