Phase 2 aus dem Native-Auth-Vollausbau-Plan (Option A, siehe ../mana/docs/MANA_SWIFT.md). Entstanden weil drei Apps fast- byte-identische LoginView.swift hatten und Sign-Up/Forgot-PW komplett fehlten. ManaAuthUI-Library mit: - ManaBrandConfig — App-injizierte Theme-Werte (forest für Cards/ Manaspur, mana-default für Memoro), Environment-Key, View-Modifier - Base-Components: ManaAuthScaffold, ManaPrimaryButton, ManaTextField, ManaSecureField + .manaEmailField()-Modifier - ManaLoginView + LoginViewModel — Email/PW-Login, schaltet bei AuthError.emailNotVerified automatisch auf ManaEmailVerifyGateView - ManaSignUpView + SignUpViewModel — Email/Name/PW + awaiting- Verification-Hinweis-Screen - ManaEmailVerifyGateView + ViewModel — Resend-Verification - ManaForgotPasswordView + ViewModel — Reset-Mail anfordern (immer generischer Hinweis, User-Enumeration-Schutz) - ManaResetPasswordView + ViewModel — neues PW mit Token aus Universal-Link - ManaChangeEmailView, ManaChangePasswordView, ManaDeleteAccountView + internal ViewModels — Account-Bausteine - ManaDeleteAccountView ist zweistufig (Bestätigungs-Wort tippen + Passwort) → App-Store-Guideline 5.1.1(v) Pflicht-Surface 26/26 ViewModel-Tests grün via per-test-ID URLProtocol-Routing (löst Parallel-Pollution zwischen .serialized Suites). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
111 lines
4.2 KiB
Markdown
111 lines
4.2 KiB
Markdown
# CLAUDE.md — mana-swift-ui
|
|
|
|
Guidance für Claude Code in diesem Repo.
|
|
|
|
> **Übergeordneter Plan:** `../mana/docs/MANA_SWIFT.md` ist die SOT für
|
|
> die ganze native-App-Plattform. Phase ε dort beschreibt dieses Paket.
|
|
|
|
## Was dieses Repo ist
|
|
|
|
Swift-Package mit native UI-Komponenten für alle nativen
|
|
mana-e.V.-Apps. Heute genau ein Library-Product:
|
|
|
|
- **ManaAuthUI** — vollständige Auth-Reise als SwiftUI-Views:
|
|
Login, Sign-Up, Email-Verifikation, Passwort-Reset,
|
|
Account-Management. Konsumiert `ManaCore` (für API-Calls) und
|
|
`ManaTokens` (für Vereins-Designwerte).
|
|
|
|
Wird konsumiert von `cards-native`, `manaspur-native`, `memoro-native`,
|
|
geplant `nutriphi-native` und weiteren.
|
|
|
|
## Status
|
|
|
|
**v0.1.0 — initiale Extraktion 2026-05-13.**
|
|
|
|
Phase 2 aus dem Native-Auth-Vollausbau-Plan (Option A — alles nativ).
|
|
Entstanden weil drei Apps fast-byte-identische `LoginView.swift`-
|
|
Dateien hatten und Sign-Up/Forgot-PW komplett fehlten.
|
|
|
|
## Architektonische Invarianten
|
|
|
|
Nicht ohne explizite Diskussion antasten:
|
|
|
|
1. **Keine externen UI-Libraries.** Pure SwiftUI. Identische Regel wie
|
|
in `ManaCore` (`mana-swift-core/CLAUDE.md` Invariante 2).
|
|
2. **App injiziert `ManaBrandConfig`.** Keine hardcoded Farben oder
|
|
App-Namen im Paket. `forest`/`mana`/zukünftige Themes leben in der
|
|
App, nicht hier — bis ManaTokens-Theme-Variants kommen.
|
|
3. **ViewModels sind testbar, Views sind dünn.** Jede non-triviale
|
|
View hat einen begleitenden `@Observable`-ViewModel mit reiner
|
|
State-Maschine. URLProtocol-Mock-Tests gehen gegen ViewModels.
|
|
4. **Lokalisierung DE first.** Public-API-Strings auf Deutsch, EN
|
|
später via `Localizable.xcstrings`. Konsistent mit Verein-Konvention.
|
|
5. **Account-Löschung ist Pflicht-Komponente.** App-Store-Guideline
|
|
5.1.1(v) — `ManaDeleteAccountView` MUSS in jeder App, die
|
|
`ManaSignUpView` einbaut, erreichbar sein.
|
|
6. **iOS 18 / macOS 15.** Gleiche Minimums wie `mana-swift-core`.
|
|
7. **Public API ist `Sendable`.** Swift-6-Strict-Concurrency.
|
|
|
|
## Repo-Layout
|
|
|
|
```
|
|
mana-swift-ui/
|
|
├── Package.swift
|
|
├── README.md
|
|
├── CHANGELOG.md
|
|
├── CLAUDE.md dieses File
|
|
├── Sources/
|
|
│ └── ManaAuthUI/
|
|
│ ├── Brand/ ManaBrandConfig (App-injiziert)
|
|
│ ├── Components/ ManaAuthScaffold, ManaTextField, ...
|
|
│ ├── Login/ ManaLoginView + ViewModel
|
|
│ ├── Register/ ManaSignUpView + ViewModel
|
|
│ ├── Verify/ ManaEmailVerifyGateView
|
|
│ ├── Reset/ ManaForgotPasswordView, ManaResetPasswordView
|
|
│ └── Account/ ChangeEmail/ChangePassword/DeleteAccount
|
|
└── Tests/
|
|
└── ManaAuthUITests/
|
|
```
|
|
|
|
## Konventionen
|
|
|
|
- **Swift 6.0**, Strict Concurrency komplett
|
|
- **iOS 18 / macOS 15** Minimum
|
|
- **Tabs** für Indent? Nein — wir nutzen 4 Spaces wie `mana-swift-core`
|
|
(SwiftFormat `.swiftformat`). Verein-TS-Repos nutzen Tabs, Swift-Repos
|
|
Spaces — bewusster Bruch wegen Xcode-Tooling
|
|
- **Doc-Comments** pflicht auf jedem `public`-Symbol (`///`)
|
|
- **Lokalisierung:** Public-API-Strings auf Deutsch
|
|
|
|
## Versionierung
|
|
|
|
- **Semver strikt.** UI ändert sich öfter als Auth-Core — getrenntes
|
|
Repo damit `mana-swift-core` stabil bleibt
|
|
- **CHANGELOG.md pflicht.** Was hat sich geändert, müssen Apps was anpassen
|
|
- **Pflege-Politik:** Letzte zwei Minor-Versionen mit Patches
|
|
|
|
## Lokal entwickeln
|
|
|
|
```bash
|
|
swift build # baut ManaAuthUI
|
|
swift test # Unit-Tests gegen ViewModels
|
|
```
|
|
|
|
`mana-swift-core` muss als Schwester-Verzeichnis existieren.
|
|
|
|
## Wenn ein neuer Auth-Flow dazukommt
|
|
|
|
1. ViewModel zuerst — pure State-Maschine, testbar
|
|
2. SwiftUI-View dünn, nur `@Observable`-State-Bindings
|
|
3. Public-API-Doc auf Deutsch
|
|
4. ViewModel-Tests via URLProtocol-Mock (Pattern in
|
|
`ManaAuthUITests/`)
|
|
5. CHANGELOG.md ergänzen
|
|
6. Bei Breaking-Change: Major-Bump-Plan + alle aktiven Apps informieren
|
|
|
|
## Wichtige Cross-Repo-Doks
|
|
|
|
- `../mana/docs/MANA_SWIFT.md` — Plattform-SOT, Phase ε
|
|
- `../mana-swift-core/CLAUDE.md` — Auth-Core, ManaTokens
|
|
- `../mana/docs/THEMING.md` — Token-SOT, spiegelt sich in ManaTokens
|
|
- `../mana/services/mana-auth/CLAUDE.md` — Server-Konventionen
|