# air-whisper/airwhisper architecture

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

- Interactive diagram: https://gitdiagram.com/air-whisper/airwhisper
- Repository: https://github.com/air-whisper/airwhisper

## Overview

AirWhisper is an assistive communication system: users compose text on Apple Watch through motion-based handwriting or quick phrases, then speak it, save it, or send it to a contact. An iPhone companion manages account setup, contacts, phrases, watch settings, and synchronization. The graph includes documented AirWrite recognition and OrientWrite motion paths, plus companion persistence and authentication. Some subsystem relationships are based on the SOURCE INDEX rather than complete source excerpts; unverified links are omitted.

Main entry points: [`AirWhisper Watch App/Views/QuickSpeakView.swift`](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/QuickSpeakView.swift) (Quick Speak), [`AirWhisper Watch App/Services/WatchConnectivityClient.swift`](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Services/WatchConnectivityClient.swift) (Watch connectivity), [`AirWhisper Watch App/Views/OrientWriteView.swift`](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/OrientWriteView.swift) (OrientWrite screen), [`AirWhisper Watch App/Views/ActionRequiredView.swift`](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/ActionRequiredView.swift) (Text actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_watch_ui["Watch experience"]
  node_watch_app["Watch app"]
  node_watch_home["Watch home<br/>[ContentView.swift]"]
  node_quick_speak["Quick Speak"]
  node_airwrite_view["AirWrite screen<br/>[AirWriteView.swift]"]
  node_orient_view["OrientWrite screen"]
  node_action_view["Text actions"]
  node_contact_select["Contact selection"]
end

subgraph group_watch_core["Watch input and services"]
  node_airwrite_motion["AirWrite recorder"]
  node_motion_sample["Motion samples<br/>[MotionSample.swift]"]
  node_ml_runner["Recognition runner"]
  node_preprocessor["Stroke preprocessing"]
  node_orient_motion["OrientWrite motion"]
  node_handwriting_service["Handwriting service"]
  node_phrase_manager["Phrase manager"]
  node_speech_service["Speech output"]
  node_watch_connectivity["Watch connectivity"]
end

subgraph group_companion["iPhone companion"]
  node_home_screen["Companion home"]
end

subgraph group_companion_data["Account and sync"]
  node_auth_service["Authentication<br/>[AuthService.swift]"]
  node_data_manager["Companion data<br/>[DataManager.swift]"]
  node_storage[("Local and cloud storage")]
  node_iphone_connectivity["iPhone connectivity"]
end

node_watch_user(("Watch user"))
node_iphone_user(("iPhone user"))
node_backend["Authentication backend"]

node_watch_user -->|"opens"| node_watch_app
node_watch_app -->|"shows"| node_watch_home
node_watch_app -->|"initializes"| node_watch_connectivity
node_watch_home -->|"opens"| node_quick_speak
node_quick_speak -->|"opens"| node_airwrite_view
node_quick_speak -->|"opens"| node_orient_view
node_quick_speak -->|"opens"| node_action_view
node_quick_speak -->|"uses"| node_phrase_manager
node_airwrite_view -.->|"records strokes"| node_airwrite_motion
node_airwrite_motion -->|"produces samples"| node_motion_sample
node_ml_runner -->|"preprocesses with"| node_preprocessor
node_ml_runner -->|"consumes"| node_motion_sample
node_orient_view -->|"tracks movement"| node_orient_motion
node_orient_view -->|"requests recognition"| node_handwriting_service
node_orient_view -->|"reads settings"| node_watch_connectivity
node_action_view -->|"opens"| node_contact_select
node_action_view -->|"saves phrase"| node_phrase_manager
node_action_view -->|"speaks text"| node_speech_service
node_contact_select -->|"sends message"| node_watch_connectivity
node_phrase_manager -->|"syncs phrases"| node_watch_connectivity
node_watch_connectivity -.->|"exchanges data"| node_iphone_connectivity
node_iphone_user -->|"uses"| node_home_screen
node_home_screen -->|"reads settings"| node_data_manager
node_data_manager -->|"persists data"| node_storage
node_data_manager -->|"syncs watch data"| node_iphone_connectivity
node_iphone_connectivity -->|"updates from watch"| node_data_manager
node_iphone_connectivity -->|"refreshes credentials"| node_auth_service
node_auth_service -->|"sends auth requests"| node_backend
node_auth_service -->|"stores credentials"| node_storage

click node_watch_app "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/App/WAAirWhisperApp.swift"
click node_watch_home "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/ContentView.swift"
click node_quick_speak "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/QuickSpeakView.swift"
click node_airwrite_view "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/AirWriteView.swift"
click node_orient_view "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/OrientWriteView.swift"
click node_action_view "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/ActionRequiredView.swift"
click node_contact_select "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/ContactSelectView.swift"
click node_airwrite_motion "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Motion/AirWriteMotionRecorder.swift"
click node_motion_sample "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Motion/MotionSample.swift"
click node_ml_runner "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/ML/AirWriteMLRunner.swift"
click node_preprocessor "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/ML/AirWritePreprocessor.swift"
click node_orient_motion "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Motion/OrientWriteMotionManager.swift"
click node_handwriting_service "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Services/GoogleHandwritingService.swift"
click node_phrase_manager "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Services/PhraseManager.swift"
click node_speech_service "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Services/SpeechService.swift"
click node_watch_connectivity "https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Services/WatchConnectivityClient.swift"
click node_home_screen "https://github.com/air-whisper/airwhisper/blob/main/AirWhisperCompanionApp/HomeViewController.swift"
click node_auth_service "https://github.com/air-whisper/airwhisper/blob/main/AirWhisperCompanionApp/Services/AuthService.swift"
click node_data_manager "https://github.com/air-whisper/airwhisper/blob/main/AirWhisperCompanionApp/DataModels/DataManager.swift"
click node_storage "https://github.com/air-whisper/airwhisper/blob/main/AirWhisperCompanionApp/DataModels/StorageManager.swift"
click node_iphone_connectivity "https://github.com/air-whisper/airwhisper/blob/main/AirWhisperCompanionApp/Services/WatchConnectivityManager.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_watch_app,node_watch_home,node_quick_speak,node_airwrite_view,node_orient_view,node_action_view,node_contact_select,node_watch_user,node_iphone_user toneBlue
class node_airwrite_motion,node_motion_sample,node_ml_runner,node_preprocessor,node_orient_motion,node_handwriting_service,node_phrase_manager,node_speech_service,node_watch_connectivity toneAmber
class node_home_screen toneMint
class node_auth_service,node_data_manager,node_storage,node_iphone_connectivity toneRose
class node_backend toneIndigo
```

## Components

### Watch experience

- [Watch app](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/App/WAAirWhisperApp.swift): `AirWhisper Watch App/App/WAAirWhisperApp.swift`
- [Watch home](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/ContentView.swift): `AirWhisper Watch App/Views/ContentView.swift`
- [Quick Speak](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/QuickSpeakView.swift): `AirWhisper Watch App/Views/QuickSpeakView.swift`
- [AirWrite screen](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/AirWriteView.swift): `AirWhisper Watch App/Views/AirWriteView.swift`
- [OrientWrite screen](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/OrientWriteView.swift): `AirWhisper Watch App/Views/OrientWriteView.swift`
- [Text actions](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/ActionRequiredView.swift): `AirWhisper Watch App/Views/ActionRequiredView.swift`
- [Contact selection](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Views/ContactSelectView.swift): `AirWhisper Watch App/Views/ContactSelectView.swift`

### Watch input and services

- [AirWrite recorder](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Motion/AirWriteMotionRecorder.swift): `AirWhisper Watch App/Motion/AirWriteMotionRecorder.swift`
- [Motion samples](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Motion/MotionSample.swift): `AirWhisper Watch App/Motion/MotionSample.swift`
- [Recognition runner](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/ML/AirWriteMLRunner.swift): `AirWhisper Watch App/ML/AirWriteMLRunner.swift`
- [Stroke preprocessing](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/ML/AirWritePreprocessor.swift): `AirWhisper Watch App/ML/AirWritePreprocessor.swift`
- [OrientWrite motion](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Motion/OrientWriteMotionManager.swift): `AirWhisper Watch App/Motion/OrientWriteMotionManager.swift`
- [Handwriting service](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Services/GoogleHandwritingService.swift): `AirWhisper Watch App/Services/GoogleHandwritingService.swift`
- [Phrase manager](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Services/PhraseManager.swift): `AirWhisper Watch App/Services/PhraseManager.swift`
- [Speech output](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Services/SpeechService.swift): `AirWhisper Watch App/Services/SpeechService.swift`
- [Watch connectivity](https://github.com/air-whisper/airwhisper/blob/main/AirWhisper%20Watch%20App/Services/WatchConnectivityClient.swift): `AirWhisper Watch App/Services/WatchConnectivityClient.swift`

### iPhone companion

- [Companion home](https://github.com/air-whisper/airwhisper/blob/main/AirWhisperCompanionApp/HomeViewController.swift): `AirWhisperCompanionApp/HomeViewController.swift`

### Account and sync

- [Authentication](https://github.com/air-whisper/airwhisper/blob/main/AirWhisperCompanionApp/Services/AuthService.swift): `AirWhisperCompanionApp/Services/AuthService.swift`
- [Companion data](https://github.com/air-whisper/airwhisper/blob/main/AirWhisperCompanionApp/DataModels/DataManager.swift): `AirWhisperCompanionApp/DataModels/DataManager.swift`
- [Local and cloud storage](https://github.com/air-whisper/airwhisper/blob/main/AirWhisperCompanionApp/DataModels/StorageManager.swift): `AirWhisperCompanionApp/DataModels/StorageManager.swift`
- [iPhone connectivity](https://github.com/air-whisper/airwhisper/blob/main/AirWhisperCompanionApp/Services/WatchConnectivityManager.swift): `AirWhisperCompanionApp/Services/WatchConnectivityManager.swift`

### Other components

- **Watch user**
- **iPhone user**
- **Authentication backend**

## Connections

- Watch user → Watch app: opens
- Watch app → Watch home: shows (evidence: `AirWhisper Watch App/App/WAAirWhisperApp.swift`)
- Watch app → Watch connectivity: initializes (evidence: `AirWhisper Watch App/App/WAAirWhisperApp.swift`)
- Watch home → Quick Speak: opens (evidence: `AirWhisper Watch App/Views/ContentView.swift`)
- Quick Speak → AirWrite screen: opens (evidence: `AirWhisper Watch App/Views/QuickSpeakView.swift`)
- Quick Speak → OrientWrite screen: opens (evidence: `AirWhisper Watch App/Views/QuickSpeakView.swift`)
- Quick Speak → Text actions: opens (evidence: `AirWhisper Watch App/Views/QuickSpeakView.swift`)
- Quick Speak → Phrase manager: uses (evidence: `AirWhisper Watch App/Views/QuickSpeakView.swift`)
- AirWrite screen → AirWrite recorder: records strokes
- AirWrite recorder → Motion samples: produces samples (evidence: `AirWhisper Watch App/Motion/AirWriteMotionRecorder.swift`)
- Recognition runner → Stroke preprocessing: preprocesses with (evidence: `AirWhisper Watch App/ML/AirWriteMLRunner.swift`)
- Recognition runner → Motion samples: consumes (evidence: `AirWhisper Watch App/ML/AirWriteMLRunner.swift`)
- OrientWrite screen → OrientWrite motion: tracks movement (evidence: `AirWhisper Watch App/Views/OrientWriteView.swift`)
- OrientWrite screen → Handwriting service: requests recognition (evidence: `AirWhisper Watch App/Views/OrientWriteView.swift`)
- OrientWrite screen → Watch connectivity: reads settings (evidence: `AirWhisper Watch App/Views/OrientWriteView.swift`)
- Text actions → Contact selection: opens (evidence: `AirWhisper Watch App/Views/ActionRequiredView.swift`)
- Text actions → Phrase manager: saves phrase (evidence: `AirWhisper Watch App/Views/ActionRequiredView.swift`)
- Text actions → Speech output: speaks text (evidence: `AirWhisper Watch App/Views/ActionRequiredView.swift`)
- Contact selection → Watch connectivity: sends message (evidence: `AirWhisper Watch App/Views/ContactSelectView.swift`)
- Phrase manager → Watch connectivity: syncs phrases (evidence: `AirWhisper Watch App/Services/PhraseManager.swift`)
- Watch connectivity → iPhone connectivity: exchanges data
- iPhone user → Companion home: uses
- Companion home → Companion data: reads settings (evidence: `AirWhisperCompanionApp/HomeViewController.swift`)
- Companion data → Local and cloud storage: persists data (evidence: `AirWhisperCompanionApp/DataModels/DataManager.swift`)
- Companion data → iPhone connectivity: syncs watch data (evidence: `AirWhisperCompanionApp/DataModels/DataManager.swift`)
- iPhone connectivity → Companion data: updates from watch (evidence: `AirWhisperCompanionApp/Services/WatchConnectivityManager.swift`)
- iPhone connectivity → Authentication: refreshes credentials (evidence: `AirWhisperCompanionApp/Services/WatchConnectivityManager.swift`)
- Authentication → Authentication backend: sends auth requests (evidence: `AirWhisperCompanionApp/Services/AuthService.swift`)
- Authentication → Local and cloud storage: stores credentials (evidence: `AirWhisperCompanionApp/Services/AuthService.swift`)
