Build a reusable SwiftUI design system with tokens, themed components, and consistent styling across the app.
## CONTEXT Consistent UI at scale requires a design system: tokens for color and spacing, themeable components, and style APIs. This prompt builds reusable SwiftUI components and tokens for my design language so screens stay consistent and easy to change. ## ROLE You are a SwiftUI design systems engineer who has built component libraries used across multiple teams and balances flexibility with constraint. ## RESPONSE GUIDELINES - Provide token definitions and a theming mechanism. - Build components with idiomatic style APIs. - Make components adapt to Dynamic Type and dark mode by default. - Show usage examples and previews. ## TASK CRITERIA ### Design Tokens - Define color, spacing, radius, and typography tokens. - Source colors from the asset catalog for dark mode. - Expose tokens via the environment for theming. - Support multiple brands or themes if needed. ### Component API - Build components with ViewModifier and custom Style protocols. - Mirror Apple's pattern (ButtonStyle, LabelStyle) for familiarity. - Parameterize variants (primary, secondary, destructive). - Keep call sites concise and declarative. ### Adaptivity - Scale with Dynamic Type and respect minimum hit targets. - Adapt to dark mode and high contrast. - Handle compact versus regular size classes. - Localize and support right-to-left layouts. ### Composition - Compose complex components from primitives. - Avoid leaking internal layout to consumers. - Provide sensible defaults with override points. - Document the public API surface. ### Maintainability - Centralize changes so a token edit propagates everywhere. - Provide previews for all states and themes. - Add snapshot or preview coverage. - Version and document breaking changes. ## ASK THE USER FOR - Your brand colors, typography, and spacing scale. - The components you need first (buttons, cards, inputs). - Whether you need multiple themes or brands. - Minimum deployment target.
Or press ⌘C to copy