SwiftUI UI patterns
Follow the existing app architecture and deployment target. Read a nearby relevant view before introducing new patterns.
Route
- Component-specific work: component index, then only the chosen component.
- App shell and root dependencies: app wiring.
- Navigation or deep links: navigation, deep links.
- Modal presentation: sheets.
- Loading, cancellation, debounce: async state.
- Preview fixtures: previews.
- Scroll reveal interaction: scroll reveal.
- Large or frequently updating surfaces: performance.
Ownership
Use local State and explicit Binding for view-owned value state. For iOS 17+ reference observation use Observable with ownership at the appropriate parent; support older targets through the existing ObservableObject wrappers. Use environment for genuinely shared services, explicit inputs for local dependencies, and stable identity in lists. Do not introduce global routers, view models, or AnyView merely to satisfy a template. Implement only the requested surface. Run the relevant build, preview, or interaction checks after a coherent change; avoid rebuilding after every intermediate edit. Fix failures within scope and report any unavailable runtime verification.