SwiftUI UI Patterns
$ npx skills add https://craftwork.design/skills/swiftui-ui-patterns -a claude-code -y
$ npx skills add https://craftwork.design/skills/swiftui-ui-patterns -a claude-code -y
| Scenario | Preferred pattern |
|---|---|
| Local UI state owned by one view | @State |
| Child mutates parent-owned value state | @Binding |
| Root-owned reference model on iOS 17+ | @State with an @Observable type |
Child reads or mutates an injected @Observable model on iOS 17+ | Pass it explicitly as a stored property |
| Shared app service or configuration | @Environment(Type.self) |
| Legacy reference model on iOS 16 and earlier | @StateObject at the root, @ObservedObject when injected |