← ClaudeAtlas

ios-swiftuilisted

Expert SwiftUI development skill for building iOS apps. Covers layout system (VStack/HStack/ZStack/Grid/LazyStacks), state management (@State/@Binding/@Observable/@Environment), navigation (NavigationStack/NavigationSplitView), animations (springs/transitions/matchedGeometryEffect/PhaseAnimator/KeyframeAnimator), lists and scroll views, sheets/alerts/popovers, custom ViewModifiers and ViewBuilders, SwiftUI lifecycle, performance optimization, and UIKit interop. Use this skill whenever the user builds SwiftUI views, layouts, navigation, animations, or asks about SwiftUI state management, view lifecycle, or performance. Triggers on any SwiftUI-related work including: SwiftUI, View, @State, @Binding, @Observable, NavigationStack, List, ScrollView, sheet, alert, animation, transition, ViewModifier, @ViewBuilder, GeometryReader, LazyVStack, TabView, toolbar, searchable, AsyncImage, or any iOS UI development with Swift.
ebbaunqualified520/ios-agent-skills · ★ 0 · Web & Frontend · score 72
Install: claude install-skill ebbaunqualified520/ios-agent-skills
# iOS SwiftUI Expert Skill ## Core Rules 1. **Use @Observable (iOS 17+) over ObservableObject** — fine-grained property tracking, better performance, simpler syntax. 2. **Use @State to own @Observable instances**, NOT @StateObject. `@StateObject` is the pre-iOS 17 pattern. 3. **Use NavigationStack** (not NavigationView) with value-based `NavigationLink` + `.navigationDestination`. 4. **Never nest NavigationStack inside NavigationStack** — causes double navigation bars and broken behavior. 5. **Use LazyVStack/LazyHStack inside ScrollView** for large collections. Use `List` for very large datasets (cell reuse + prefetching). 6. **Keep `body` pure** — no data processing, network calls, or side effects. Use `.task` modifier for async work. 7. **Avoid `AnyView`** — it destroys view identity and kills diffing performance. Use `@ViewBuilder` or `Group` instead. 8. **Preserve view identity** — use ternary operators (`condition ? viewA : viewB`), not `if/else` that changes the view type in ways that break animations. 9. **Break large views into small subviews** — SwiftUI re-evaluates `body` often; smaller views = smaller re-evaluation scope. 10. **Use `.equatable()`** on expensive views to skip unnecessary re-renders. --- ## Decision Tables ### State Management — What to Use When | Scenario | iOS 17+ | Pre-iOS 17 | |---|---|---| | Simple value owned by view | `@State` | `@State` | | Pass value down for read/write | `@Binding` | `@Binding` | | Reference-type model owned by view |