# coolerwave/aimmac architecture

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

- Interactive diagram: https://gitdiagram.com/coolerwave/aimmac
- Repository: https://github.com/coolerwave/aimmac

## Overview

AimMac turns iPhone or Apple Watch motion and gestures into Mac pointer control: the device pairs over Bluetooth, streams input, and the Mac receiver dispatches it to cursor control. Phone and watch views provide pairing and remote controls; the Mac notch panel exposes status and controls. The repository also includes Ping Pong, a browser game played with the cursor. The README documents the game’s opponent, difficulty, scoring, and market-screen features, but its implementation is represented only by index.html in the tree; unsampled code paths are not inferred.

Main entry points: [`Mac/Sources/AppDelegate.swift`](https://github.com/coolerwave/aimmac/blob/main/Mac/Sources/AppDelegate.swift) (Mac App Coordinator), [`Apple/iOS/PhoneView.swift`](https://github.com/coolerwave/aimmac/blob/main/Apple/iOS/PhoneView.swift) (Phone Remote UI), [`Apple/Shared/PointerSession.swift`](https://github.com/coolerwave/aimmac/blob/main/Apple/Shared/PointerSession.swift) (Pointer Session), [`index.html`](https://github.com/coolerwave/aimmac/blob/main/index.html) (Ping Pong Game)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_device["Phone and Watch"]
  node_phone_app["iPhone App<br/>[AimPhoneApp.swift]"]
  node_phone_ui["Phone Remote UI<br/>[PhoneView.swift]"]
  node_watch_app["Watch App<br/>[AimWatchApp.swift]"]
  node_watch_ui["Watch Remote UI<br/>[WatchView.swift]"]
end

subgraph group_link["Wireless Input"]
  node_session["Pointer Session"]
  node_motion["Motion Aiming<br/>[MotionAim.swift]"]
  node_maclink["Bluetooth Client<br/>[MacLink.swift]"]
  node_protocol["Packet Protocol<br/>[Protocol.swift]"]
end

subgraph group_mac["Mac Pointer Control"]
  node_receiver["Bluetooth Receiver<br/>[Receiver.swift]"]
  node_delegate["Mac App Coordinator<br/>[AppDelegate.swift]"]
  node_engine["Pointer Engine"]
  node_filter["Aim Smoothing<br/>[OneEuro.swift]"]
  node_notch["Notch Controls<br/>[NotchPanel.swift]"]
  node_cursor(("Mac Cursor"))
end

subgraph group_game["Browser Game"]
  node_browser(("Browser Player"))
  node_game["Ping Pong Game<br/>[index.html]"]
  node_opponents["Opponent Roster<br/>[index.html]"]
  node_market["Stock Market Screen<br/>[index.html]"]
end

node_user(("Player"))

node_user -->|"uses remote"| node_phone_ui
node_user -->|"uses remote"| node_watch_ui
node_phone_app -->|"shows"| node_phone_ui
node_watch_app -->|"shows"| node_watch_ui
node_phone_ui -->|"controls"| node_session
node_watch_ui -->|"controls"| node_session
node_session -->|"starts and stops"| node_motion
node_session -->|"sends input"| node_maclink
node_phone_ui -->|"moves trackpad"| node_maclink
node_maclink -->|"streams Bluetooth input"| node_receiver
node_user -->|"approves pairing"| node_receiver
node_receiver -->|"dispatches events"| node_delegate
node_delegate -->|"starts receiver"| node_receiver
node_delegate -->|"configures and controls"| node_engine
node_delegate -->|"updates status"| node_notch
node_delegate -->|"uses smoothing"| node_filter
node_engine -->|"posts pointer events"| node_cursor
node_cursor -->|"controls play"| node_game
node_browser -->|"plays"| node_game
node_game -->|"offers opponents"| node_opponents
node_game -->|"shows match ticker"| node_market

click node_phone_app "https://github.com/coolerwave/aimmac/blob/main/Apple/iOS/AimPhoneApp.swift"
click node_phone_ui "https://github.com/coolerwave/aimmac/blob/main/Apple/iOS/PhoneView.swift"
click node_watch_app "https://github.com/coolerwave/aimmac/blob/main/Apple/Watch/AimWatchApp.swift"
click node_watch_ui "https://github.com/coolerwave/aimmac/blob/main/Apple/Watch/WatchView.swift"
click node_session "https://github.com/coolerwave/aimmac/blob/main/Apple/Shared/PointerSession.swift"
click node_motion "https://github.com/coolerwave/aimmac/blob/main/Apple/Shared/MotionAim.swift"
click node_maclink "https://github.com/coolerwave/aimmac/blob/main/Apple/Shared/MacLink.swift"
click node_protocol "https://github.com/coolerwave/aimmac/blob/main/Shared/Protocol.swift"
click node_receiver "https://github.com/coolerwave/aimmac/blob/main/Mac/Sources/Receiver.swift"
click node_delegate "https://github.com/coolerwave/aimmac/blob/main/Mac/Sources/AppDelegate.swift"
click node_engine "https://github.com/coolerwave/aimmac/blob/main/Mac/Sources/PointerEngine.swift"
click node_filter "https://github.com/coolerwave/aimmac/blob/main/Mac/Sources/OneEuro.swift"
click node_notch "https://github.com/coolerwave/aimmac/blob/main/Mac/Sources/NotchPanel.swift"
click node_game "https://github.com/coolerwave/aimmac/blob/main/index.html"
click node_opponents "https://github.com/coolerwave/aimmac/blob/main/index.html"
click node_market "https://github.com/coolerwave/aimmac/blob/main/index.html"

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_phone_app,node_phone_ui,node_watch_app,node_watch_ui toneBlue
class node_session,node_motion,node_maclink,node_protocol toneAmber
class node_receiver,node_delegate,node_engine,node_filter,node_notch,node_cursor toneMint
class node_browser,node_game,node_opponents,node_market toneRose
class node_user toneIndigo
```

## Components

### Phone and Watch

- [iPhone App](https://github.com/coolerwave/aimmac/blob/main/Apple/iOS/AimPhoneApp.swift): `Apple/iOS/AimPhoneApp.swift`
- [Phone Remote UI](https://github.com/coolerwave/aimmac/blob/main/Apple/iOS/PhoneView.swift): `Apple/iOS/PhoneView.swift`
- [Watch App](https://github.com/coolerwave/aimmac/blob/main/Apple/Watch/AimWatchApp.swift): `Apple/Watch/AimWatchApp.swift`
- [Watch Remote UI](https://github.com/coolerwave/aimmac/blob/main/Apple/Watch/WatchView.swift): `Apple/Watch/WatchView.swift`

### Wireless Input

- [Pointer Session](https://github.com/coolerwave/aimmac/blob/main/Apple/Shared/PointerSession.swift): `Apple/Shared/PointerSession.swift`
- [Motion Aiming](https://github.com/coolerwave/aimmac/blob/main/Apple/Shared/MotionAim.swift): `Apple/Shared/MotionAim.swift`
- [Bluetooth Client](https://github.com/coolerwave/aimmac/blob/main/Apple/Shared/MacLink.swift): `Apple/Shared/MacLink.swift`
- [Packet Protocol](https://github.com/coolerwave/aimmac/blob/main/Shared/Protocol.swift): `Shared/Protocol.swift`

### Mac Pointer Control

- [Bluetooth Receiver](https://github.com/coolerwave/aimmac/blob/main/Mac/Sources/Receiver.swift): `Mac/Sources/Receiver.swift`
- [Mac App Coordinator](https://github.com/coolerwave/aimmac/blob/main/Mac/Sources/AppDelegate.swift): `Mac/Sources/AppDelegate.swift`
- [Pointer Engine](https://github.com/coolerwave/aimmac/blob/main/Mac/Sources/PointerEngine.swift): `Mac/Sources/PointerEngine.swift`
- [Aim Smoothing](https://github.com/coolerwave/aimmac/blob/main/Mac/Sources/OneEuro.swift): `Mac/Sources/OneEuro.swift`
- [Notch Controls](https://github.com/coolerwave/aimmac/blob/main/Mac/Sources/NotchPanel.swift): `Mac/Sources/NotchPanel.swift`
- **Mac Cursor**

### Browser Game

- **Browser Player**
- [Ping Pong Game](https://github.com/coolerwave/aimmac/blob/main/index.html): `index.html`
- [Opponent Roster](https://github.com/coolerwave/aimmac/blob/main/index.html): `index.html`
- [Stock Market Screen](https://github.com/coolerwave/aimmac/blob/main/index.html): `index.html`

### Other components

- **Player**

## Connections

- Player → Phone Remote UI: uses remote (evidence: `README.md`)
- Player → Watch Remote UI: uses remote (evidence: `README.md`)
- iPhone App → Phone Remote UI: shows (evidence: `Apple/iOS/AimPhoneApp.swift`)
- Watch App → Watch Remote UI: shows (evidence: `Apple/Watch/AimWatchApp.swift`)
- Phone Remote UI → Pointer Session: controls (evidence: `Apple/iOS/PhoneView.swift`)
- Watch Remote UI → Pointer Session: controls (evidence: `Apple/Watch/WatchView.swift`)
- Pointer Session → Motion Aiming: starts and stops (evidence: `Apple/Shared/PointerSession.swift`)
- Pointer Session → Bluetooth Client: sends input (evidence: `Apple/Shared/PointerSession.swift`)
- Phone Remote UI → Bluetooth Client: moves trackpad (evidence: `Apple/iOS/PhoneView.swift`)
- Bluetooth Client → Bluetooth Receiver: streams Bluetooth input (evidence: `README.md`)
- Player → Bluetooth Receiver: approves pairing
- Bluetooth Receiver → Mac App Coordinator: dispatches events (evidence: `Mac/Sources/Receiver.swift`)
- Mac App Coordinator → Bluetooth Receiver: starts receiver (evidence: `Mac/Sources/AppDelegate.swift`)
- Mac App Coordinator → Pointer Engine: configures and controls (evidence: `Mac/Sources/AppDelegate.swift`)
- Mac App Coordinator → Notch Controls: updates status (evidence: `Mac/Sources/AppDelegate.swift`)
- Mac App Coordinator → Aim Smoothing: uses smoothing (evidence: `Mac/Sources/AppDelegate.swift`)
- Pointer Engine → Mac Cursor: posts pointer events (evidence: `Mac/Sources/PointerEngine.swift`)
- Mac Cursor → Ping Pong Game: controls play (evidence: `README.md`)
- Browser Player → Ping Pong Game: plays (evidence: `README.md`)
- Ping Pong Game → Opponent Roster: offers opponents (evidence: `README.md`)
- Ping Pong Game → Stock Market Screen: shows match ticker (evidence: `README.md`)
