# mev297/tide architecture

> Architecture diagram of the GitHub repository mev297/tide, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mev297/tide
- Repository: https://github.com/mev297/tide

## Overview

Tide is an on-device SwiftUI period tracker. A user logs period starts in Today or Calendar; the app’s view model validates changes, updates cycle data, persists it, and refreshes reminders. Cycle calculations provide phase, timing, and history for the calendar, insights, and widget. The product also documents notification/widget quick logging, accidental-tap confirmation, late-cycle handling, and milestone celebrations. Storage and notification wiring are supported by excerpts; several view and widget connections rely on the SOURCE INDEX or README, so unsampled behavior is not expanded.

Main entry points: [`Tide/ViewModels/CycleViewModel.swift`](https://github.com/mev297/tide/blob/main/Tide/ViewModels/CycleViewModel.swift) (Cycle View Model), [`Tide/Views/ContentView.swift`](https://github.com/mev297/tide/blob/main/Tide/Views/ContentView.swift) (Tab Navigation), [`Tide/Views/HomeView.swift`](https://github.com/mev297/tide/blob/main/Tide/Views/HomeView.swift) (Today Screen), [`TideWidget/TideWidget.swift`](https://github.com/mev297/tide/blob/main/TideWidget/TideWidget.swift) (Home And Lock Widgets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["iPhone App"]
  node_app_entry["App Startup<br/>[TideApp.swift]"]
  node_tabs["Tab Navigation<br/>[ContentView.swift]"]
  node_today["Today Screen<br/>[HomeView.swift]"]
  node_calendar["Calendar Screen<br/>[CalendarView.swift]"]
  node_insights["Insights Screen<br/>[InsightsView.swift]"]
  node_settings["Settings Screen<br/>[SettingsView.swift]"]
  node_theme["Visual Theme<br/>[Theme.swift]"]
  node_wheel["Cycle Wheel<br/>[CycleWheel.swift]"]
  node_panda["Panda Mascot<br/>[PandaMascot.swift]"]
  node_milestone["Milestone Popup"]
end

subgraph group_cycle["Cycle Domain"]
  node_cycle_vm["Cycle View Model"]
  node_cycle_data["Cycle Calculations<br/>[CycleData.swift]"]
  node_cycle_phase["Phase Notes<br/>[CyclePhase.swift]"]
  node_storage[("Shared Local Storage<br/>[CycleStorage.swift]")]
end

subgraph group_reminders["Reminders"]
  node_notification_manager["Reminder Scheduling"]
  node_notification_service["iOS Notifications"]
end

subgraph group_widget["Widget"]
  node_widget["Home And Lock Widgets<br/>[TideWidget.swift]"]
end

node_user(("User"))

node_user -->|"uses app"| node_tabs
node_app_entry -->|"creates"| node_cycle_vm
node_app_entry -->|"configures"| node_notification_manager
node_app_entry -->|"shows"| node_tabs
node_tabs -->|"shows tab"| node_today
node_tabs -->|"shows tab"| node_calendar
node_tabs -->|"shows tab"| node_insights
node_tabs -->|"shows tab"| node_settings
node_tabs -->|"presents alerts"| node_cycle_vm
node_today -->|"logs period"| node_cycle_vm
node_today -->|"renders"| node_wheel
node_today -->|"renders"| node_panda
node_today -->|"shows celebration"| node_milestone
node_calendar -->|"reads and edits"| node_cycle_vm
node_insights -->|"reads trends"| node_cycle_vm
node_settings -->|"updates settings"| node_cycle_vm
node_cycle_vm -->|"updates and calculates"| node_cycle_data
node_cycle_vm -->|"saves changes"| node_storage
node_cycle_vm -->|"updates reminders"| node_notification_manager
node_storage -->|"loads and saves"| node_cycle_data
node_cycle_data -->|"determines phase"| node_cycle_phase
node_today -->|"styles screen"| node_theme
node_wheel -->|"uses colors"| node_theme
node_panda -->|"reflects phase"| node_cycle_phase
node_milestone -->|"renders"| node_panda
node_notification_manager -->|"schedules requests"| node_notification_service
node_notification_service -->|"delivers reminders"| node_user
node_notification_manager -->|"saves quick log"| node_storage
node_user -->|"uses widget"| node_widget
node_widget -->|"reads shared data"| node_storage
node_widget -->|"derives display state"| node_cycle_data
node_widget -->|"shows phase"| node_cycle_phase
node_storage -->|"reloads timeline"| node_widget

click node_app_entry "https://github.com/mev297/tide/blob/main/Tide/TideApp.swift"
click node_tabs "https://github.com/mev297/tide/blob/main/Tide/Views/ContentView.swift"
click node_today "https://github.com/mev297/tide/blob/main/Tide/Views/HomeView.swift"
click node_calendar "https://github.com/mev297/tide/blob/main/Tide/Views/CalendarView.swift"
click node_insights "https://github.com/mev297/tide/blob/main/Tide/Views/InsightsView.swift"
click node_settings "https://github.com/mev297/tide/blob/main/Tide/Views/SettingsView.swift"
click node_cycle_vm "https://github.com/mev297/tide/blob/main/Tide/ViewModels/CycleViewModel.swift"
click node_cycle_data "https://github.com/mev297/tide/blob/main/Tide/Models/CycleData.swift"
click node_cycle_phase "https://github.com/mev297/tide/blob/main/Tide/Models/CyclePhase.swift"
click node_storage "https://github.com/mev297/tide/blob/main/Tide/Models/CycleStorage.swift"
click node_theme "https://github.com/mev297/tide/blob/main/Tide/Theme.swift"
click node_wheel "https://github.com/mev297/tide/blob/main/Tide/Views/Components/CycleWheel.swift"
click node_panda "https://github.com/mev297/tide/blob/main/Tide/Views/Components/PandaMascot.swift"
click node_milestone "https://github.com/mev297/tide/blob/main/Tide/Views/Components/MilestoneCelebration.swift"
click node_notification_manager "https://github.com/mev297/tide/blob/main/Tide/Services/NotificationManager.swift"
click node_widget "https://github.com/mev297/tide/blob/main/TideWidget/TideWidget.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_entry,node_tabs,node_today,node_calendar,node_insights,node_settings,node_theme,node_wheel,node_panda,node_milestone,node_user toneBlue
class node_cycle_vm,node_cycle_data,node_cycle_phase,node_storage toneAmber
class node_notification_manager,node_notification_service toneMint
class node_widget toneRose
```

## Components

### iPhone App

- [App Startup](https://github.com/mev297/tide/blob/main/Tide/TideApp.swift): `Tide/TideApp.swift`
- [Tab Navigation](https://github.com/mev297/tide/blob/main/Tide/Views/ContentView.swift): `Tide/Views/ContentView.swift`
- [Today Screen](https://github.com/mev297/tide/blob/main/Tide/Views/HomeView.swift): `Tide/Views/HomeView.swift`
- [Calendar Screen](https://github.com/mev297/tide/blob/main/Tide/Views/CalendarView.swift): `Tide/Views/CalendarView.swift`
- [Insights Screen](https://github.com/mev297/tide/blob/main/Tide/Views/InsightsView.swift): `Tide/Views/InsightsView.swift`
- [Settings Screen](https://github.com/mev297/tide/blob/main/Tide/Views/SettingsView.swift): `Tide/Views/SettingsView.swift`
- [Visual Theme](https://github.com/mev297/tide/blob/main/Tide/Theme.swift): `Tide/Theme.swift`
- [Cycle Wheel](https://github.com/mev297/tide/blob/main/Tide/Views/Components/CycleWheel.swift): `Tide/Views/Components/CycleWheel.swift`
- [Panda Mascot](https://github.com/mev297/tide/blob/main/Tide/Views/Components/PandaMascot.swift): `Tide/Views/Components/PandaMascot.swift`
- [Milestone Popup](https://github.com/mev297/tide/blob/main/Tide/Views/Components/MilestoneCelebration.swift): `Tide/Views/Components/MilestoneCelebration.swift`

### Cycle Domain

- [Cycle View Model](https://github.com/mev297/tide/blob/main/Tide/ViewModels/CycleViewModel.swift): `Tide/ViewModels/CycleViewModel.swift`
- [Cycle Calculations](https://github.com/mev297/tide/blob/main/Tide/Models/CycleData.swift): `Tide/Models/CycleData.swift`
- [Phase Notes](https://github.com/mev297/tide/blob/main/Tide/Models/CyclePhase.swift): `Tide/Models/CyclePhase.swift`
- [Shared Local Storage](https://github.com/mev297/tide/blob/main/Tide/Models/CycleStorage.swift): `Tide/Models/CycleStorage.swift`

### Reminders

- [Reminder Scheduling](https://github.com/mev297/tide/blob/main/Tide/Services/NotificationManager.swift): `Tide/Services/NotificationManager.swift`
- **iOS Notifications**

### Widget

- [Home And Lock Widgets](https://github.com/mev297/tide/blob/main/TideWidget/TideWidget.swift): `TideWidget/TideWidget.swift`

### Other components

- **User**

## Connections

- User → Tab Navigation: uses app (evidence: `README.md`)
- App Startup → Cycle View Model: creates (evidence: `Tide/TideApp.swift`)
- App Startup → Reminder Scheduling: configures (evidence: `Tide/TideApp.swift`)
- App Startup → Tab Navigation: shows (evidence: `Tide/TideApp.swift`)
- Tab Navigation → Today Screen: shows tab (evidence: `Tide/Views/ContentView.swift`)
- Tab Navigation → Calendar Screen: shows tab (evidence: `Tide/Views/ContentView.swift`)
- Tab Navigation → Insights Screen: shows tab (evidence: `Tide/Views/ContentView.swift`)
- Tab Navigation → Settings Screen: shows tab (evidence: `Tide/Views/ContentView.swift`)
- Tab Navigation → Cycle View Model: presents alerts (evidence: `Tide/Views/ContentView.swift`)
- Today Screen → Cycle View Model: logs period (evidence: `Tide/Views/HomeView.swift`)
- Today Screen → Cycle Wheel: renders (evidence: `Tide/Views/HomeView.swift`)
- Today Screen → Panda Mascot: renders (evidence: `Tide/Views/HomeView.swift`)
- Today Screen → Milestone Popup: shows celebration (evidence: `Tide/Views/HomeView.swift`)
- Calendar Screen → Cycle View Model: reads and edits (evidence: `Tide/Views/CalendarView.swift`)
- Insights Screen → Cycle View Model: reads trends (evidence: `Tide/Views/InsightsView.swift`)
- Settings Screen → Cycle View Model: updates settings (evidence: `Tide/Views/SettingsView.swift`)
- Cycle View Model → Cycle Calculations: updates and calculates (evidence: `Tide/ViewModels/CycleViewModel.swift`)
- Cycle View Model → Shared Local Storage: saves changes (evidence: `Tide/ViewModels/CycleViewModel.swift`)
- Cycle View Model → Reminder Scheduling: updates reminders (evidence: `Tide/ViewModels/CycleViewModel.swift`)
- Shared Local Storage → Cycle Calculations: loads and saves (evidence: `Tide/Models/CycleStorage.swift`)
- Cycle Calculations → Phase Notes: determines phase (evidence: `Tide/Models/CycleData.swift`)
- Today Screen → Visual Theme: styles screen (evidence: `Tide/Views/HomeView.swift`)
- Cycle Wheel → Visual Theme: uses colors (evidence: `Tide/Views/Components/CycleWheel.swift`)
- Panda Mascot → Phase Notes: reflects phase (evidence: `Tide/Views/Components/PandaMascot.swift`)
- Milestone Popup → Panda Mascot: renders (evidence: `Tide/Views/Components/MilestoneCelebration.swift`)
- Reminder Scheduling → iOS Notifications: schedules requests (evidence: `Tide/Services/NotificationManager.swift`)
- iOS Notifications → User: delivers reminders (evidence: `README.md`)
- Reminder Scheduling → Shared Local Storage: saves quick log (evidence: `Tide/Services/NotificationManager.swift`)
- User → Home And Lock Widgets: uses widget (evidence: `README.md`)
- Home And Lock Widgets → Shared Local Storage: reads shared data (evidence: `TideWidget/TideWidget.swift`)
- Home And Lock Widgets → Cycle Calculations: derives display state (evidence: `TideWidget/TideWidget.swift`)
- Home And Lock Widgets → Phase Notes: shows phase (evidence: `TideWidget/TideWidget.swift`)
- Shared Local Storage → Home And Lock Widgets: reloads timeline (evidence: `Tide/Models/CycleStorage.swift`)
