How to use
- Open your project in your agent (Claude Code, Codex, Cursor, Antigravity, Windsurf, Copilot or any other).
- Copy the SwiftUI prompt and paste it as the task. Add your brand color if you have one.
- Add the project rules to your agent's instruction file (
CLAUDE.md,AGENTS.md,.cursor/rules, …) so later changes stay on-system. - Review the diff. The prompts ask the agent to build, check light and dark mode and list every changed file.
SwiftUI
Integrate M3EKit into an iOS, macOS or visionOS SwiftUI app.
You are integrating M3EKit (Material 3 Expressive for SwiftUI) into this project.
About the library:
- Package: https://github.com/EqviLabs/m3ekit-swift.git, product "M3EKit", from: "0.1.0". iOS 16.4+, macOS 13.3+, visionOS 1+. No dependencies.
- Components: M3EButton, M3EToggleButton, M3EIconButton, M3EIconToggleButton, M3EFab, M3EExtendedFab, M3EFabMenu, M3EButtonGroup, M3ESplitButton, M3EMenu / .m3eMenu, M3ELoadingIndicator, M3ELinearWavyProgressIndicator, M3ECircularWavyProgressIndicator, M3EMaterialShape + M3EShape (35 shapes, usable as SwiftUI Shape), M3ESwitch, M3ECheckbox, M3ERadioButton, M3ESlider, M3ERangeSlider, M3EChip, M3ETabs, M3ENavigationBar, M3ENavigationRail, M3EFloatingToolbar, M3EDockedToolbar, M3ETopAppBar, M3ECarousel, M3ECard, M3EListItem, M3EDivider, M3EBadge / .m3eBadge, M3ETextField, M3ESearchBar, .m3eDialog, .m3eBottomSheet, .m3eSnackbar, .m3eTooltip.
- Icons are Material Symbols names ("arrow_forward", "favorite") mapped to SF Symbols; names containing "." are SF Symbols.
Steps:
1. Add the Swift package (Xcode: File > Add Package Dependencies, or Package.swift: .package(url: "https://github.com/EqviLabs/m3ekit-swift.git", from: "0.1.0") and .product(name: "M3EKit", package: "m3ekit-swift")). Raise the deployment target to iOS 16.4 if lower.
2. Theme once at the root: ContentView().m3eTheme(seed: 0xRRGGBB, variant: .tonalSpot) using the app's brand color as the seed. Ask me for the brand color if it isn't obvious from the asset catalog or existing theme.
3. In your own views read tokens with @Environment(\.m3eTheme) var theme (theme.colors.surface, theme.colors.onSurface, …) and text styles with .m3eTextStyle(.titleMedium). Replace hard-coded colors you touch with roles.
4. Replace custom buttons, toggles, progress views, segmented controls and FABs with the M3EKit equivalents. Keep behavior identical; only change presentation.
5. Use .overrides only when the design requires a value the tokens don't have; prefer theme changes.
Design rules (apply on every screen you touch):
- Color: use theme color roles (primary, onPrimary, primaryContainer, onPrimaryContainer, secondaryContainer, tertiaryContainer, surface, surfaceContainer*, onSurface, onSurfaceVariant, outlineVariant). Never hard-code hex values in components. Always pair a container with its "on" role for text and icons on it.
- Hierarchy: one filled button per area for the primary action; tonal or outlined for secondary; text buttons for low emphasis.
- Shapes: use M3E shapes with intent (avatars, image masks, loaders, state changes). One strong shape per area beats many.
- Motion: use the library's springs; don't add your own timing curves to M3EKit components. Respect Reduce Motion.
- Progress: loading indicator for short indeterminate waits; wavy progress when you know how far along it is; use flat for progress that sits still for long.
- Accessibility: every icon-only control gets an accessibility label; keep touch targets at least 48dp; don't put text on busy shapes (burst, boom).
- Keep fast-changing state (progress, slider values) in the smallest component that needs it.
SwiftUI specifics:
- Bind state with @State / @Binding as the components expect (isOn:, selection:, isExpanded:). Don't wrap them in extra gesture recognizers.
- M3EMaterialShape(spinDuration:) runs on Core Animation; prefer it to custom rotation animations.
- Use .disabled(true) to disable any control.
When done:
- Build for every platform the app targets and fix all warnings you introduced.
- Run the app and check light and dark mode, Dynamic Type at a large size, and VoiceOver labels on icon-only controls.
- Summarize what you changed, file by file.Project rules file
Paste into CLAUDE.md, AGENTS.md, .cursor/rules or your agent's instructions so every future change stays on-system.
# UI system: M3EKit (Material 3 Expressive) This project's UI uses M3EKit. When you build or change UI: - Use M3EKit components first; only build custom UI when no component fits, and then build it from theme roles and M3E shapes. - Colors come from theme roles, never hex literals. Text and icons on a container use its matching "on" role. - Buttons: one filled button per area for the main action, tonal/outlined for secondary. Use button groups instead of segmented controls, split buttons for an action with variants, FAB menus for 2–6 related creation actions. - Waits: loading indicator for short indeterminate waits, wavy progress when progress is known; flat style for long, still progress. - Shapes: M3E shapes for avatars, masks and decorative accents; at most one strong shape per area. - Motion: rely on the components' springs; respect Reduce Motion; no custom easing on M3EKit components. - Accessibility: labels on all icon-only controls, 48dp touch targets, check large text. - Keep fast-changing values (progress, slider) in the smallest view that displays them. - Before finishing: build in release mode, check light and dark mode, and list the files you changed. Docs: https://m3ekit.eqvilabs.com/docs · Components: https://m3ekit.eqvilabs.com/components