Implement SwiftUI iOS
Use this skill when the desired output is SwiftUI code, not only a visual concept.
Workflow
- Inspect the existing app architecture before adding views. Follow local state, routing, dependency injection, style, and preview patterns.
- Map the screen to native SwiftUI containers:
NavigationStack,TabView,List,Form,ScrollView,Grid,ToolbarItem,sheet,confirmationDialog, andalert. - Use semantic platform APIs before custom styling:
foregroundStyle,tint,font,buttonStyle,controlSize,labelStyle,presentationDetents, and system materials. - Implement accessibility while building: labels, hints only when useful, traits, sort priority, focus, minimum target size, Dynamic Type, Reduce Motion, and color contrast.
- Add previews that exercise at least light/dark mode, large text, and small-screen layout when the project supports previews.
- Verify with the app's build/test workflow or explain the blocker.
SwiftUI Design Rules
- Prefer native controls over custom clones. Only custom-build controls when the product needs behavior the system does not provide.
- Use SF Symbols through
Image(systemName:). Pair icons with text unless the icon is universally recognized or has an accessibility label. - Use semantic colors such as
.primary,.secondary,.tint,.background, and platform materials. Avoid hardcoded colors unless creating a brand accent. - Use
.dynamicTypeSize(...)only to constrain layouts when necessary; do not disable accessibility sizes casually. - Keep forms in
Formor groupedListpatterns. Avoid building settings as arbitrary stacks. - Use
.toolbarTitleDisplayMode(.inline)for compact modal settings; use large titles for content hubs. - Make tappable rows obvious and keep destructive actions visibly distinct.
References
Read references/swiftui-ios-patterns.md for implementation patterns and examples.