# tejaswikumar8352/aircatch architecture

> Architecture diagram of the GitHub repository tejaswikumar8352/aircatch, 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/tejaswikumar8352/aircatch
- Repository: https://github.com/tejaswikumar8352/aircatch

## Overview

AirCatch provides a Mac host and iPad client for a wireless second display: the user discovers or manually connects to a host, pairs or reconnects, receives an encrypted video/audio stream, and sends touch, keyboard, and trackpad input back. The graph separates client experience, host display orchestration, media/input processing, and transport/security. Relationships are grounded in the README and shown source references; some subsystem internals were not sampled, so undocumented wiring is omitted.

Main entry points: [`AirCatchHost/HostManager.swift`](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/HostManager.swift) (Host Manager), [`AirCatchClient/ClientManager.swift`](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/ClientManager.swift) (Client Manager), [`AirCatchClient/ContentView.swift`](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/ContentView.swift) (Client Screens), [`AirCatchClient/VideoStreamOverlay.swift`](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/VideoStreamOverlay.swift) (Stream Overlay)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["iPad Client"]
  node_client_ui["Client Screens<br/>[ContentView.swift]"]
  node_client_settings["Client Settings"]
  node_client_manager["Client Manager"]
  node_bonjour_browser["Bonjour Discovery"]
  node_stream_overlay["Stream Overlay"]
end

subgraph group_host["Mac Host"]
  node_host_ui["Host Controls<br/>[HostView.swift]"]
  node_host_manager["Host Manager<br/>[HostManager.swift]"]
  node_virtual_display["Virtual Display"]
  node_display_manager["Display Matching"]
  node_bonjour_advertiser["Bonjour Advertisement"]
end

subgraph group_media["Media and Input"]
  node_touch_input["Touch and Keyboard"]
  node_video_decoder["Video Decoder<br/>[VideoDecoder.swift]"]
  node_metal_view["Metal Renderer"]
  node_audio_player["Audio Playback<br/>[AudioPlayer.swift]"]
  node_screen_streamer["Screen Capture and Encode"]
  node_bitrate["Bitrate Control"]
  node_input_injector["Native Input Injection"]
end

subgraph group_transport["Transport and Security"]
  node_network_client["Client Networking"]
  node_network_host["Host Networking"]
  node_mpc_client["Client Control Channel"]
  node_mpc_host["Host Control Channel"]
  node_client_crypto["Client Cryptography"]
  node_host_crypto["Host Cryptography"]
end

node_ipad_user(("iPad User"))
node_host_user(("Mac User"))
node_network(("IP Network"))

node_ipad_user -->|"chooses host"| node_client_ui
node_client_ui -->|"connects"| node_client_manager
node_client_ui -->|"opens settings"| node_client_settings
node_client_manager -->|"starts discovery"| node_bonjour_browser
node_client_manager -->|"exchanges packets"| node_network_client
node_client_manager -->|"uses control channel"| node_mpc_client
node_client_manager -->|"encrypts and authenticates"| node_client_crypto
node_client_manager -->|"presents stream"| node_stream_overlay
node_stream_overlay -->|"decodes frames"| node_video_decoder
node_video_decoder -->|"renders frames"| node_metal_view
node_stream_overlay -->|"captures interaction"| node_touch_input
node_touch_input -->|"sends input"| node_client_manager
node_client_manager -->|"plays decrypted audio"| node_audio_player
node_host_user -->|"controls host"| node_host_ui
node_host_ui -->|"manages host"| node_host_manager
node_host_manager -->|"advertises service"| node_bonjour_advertiser
node_host_manager -->|"handles control channel"| node_mpc_host
node_host_manager -->|"authenticates sessions"| node_host_crypto
node_host_manager -->|"creates display"| node_virtual_display
node_host_manager -->|"starts capture"| node_screen_streamer
node_host_manager -->|"adjusts display mode"| node_display_manager
node_host_manager -->|"adapts bitrate"| node_bitrate
node_host_manager -->|"dispatches input"| node_input_injector
node_screen_streamer -->|"sends encoded media"| node_network_host
node_network_host -->|"transfers encrypted packets"| node_network
node_network_client -->|"receives packets"| node_network
node_network -.->|"discovers host"| node_bonjour_advertiser
node_network -->|"carries control packets"| node_input_injector
node_input_injector -.->|"reports native events"| node_host_manager

click node_client_ui "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/ContentView.swift"
click node_client_settings "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/ClientSettingsView.swift"
click node_client_manager "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/ClientManager.swift"
click node_bonjour_browser "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/BonjourBrowser.swift"
click node_stream_overlay "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/VideoStreamOverlay.swift"
click node_touch_input "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/MouseInputView.swift"
click node_video_decoder "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/VideoDecoder.swift"
click node_metal_view "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/MetalVideoView.swift"
click node_audio_player "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/AudioPlayer.swift"
click node_host_ui "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/HostView.swift"
click node_host_manager "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/HostManager.swift"
click node_virtual_display "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/VirtualDisplayManager.swift"
click node_display_manager "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/DisplayManager.swift"
click node_screen_streamer "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/ScreenStreamer.swift"
click node_bitrate "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/BitrateCalculator.swift"
click node_input_injector "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/InputInjector.swift"
click node_network_client "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/NetworkManager.swift"
click node_network_host "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/NetworkManager.swift"
click node_mpc_client "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/MPCAirCatchClient.swift"
click node_mpc_host "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/MPCAirCatchHost.swift"
click node_client_crypto "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/CryptoManager.swift"
click node_host_crypto "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/CryptoManager.swift"
click node_bonjour_advertiser "https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/BonjourAdvertiser.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_client_ui,node_client_settings,node_client_manager,node_bonjour_browser,node_stream_overlay,node_ipad_user,node_host_user toneBlue
class node_host_ui,node_host_manager,node_virtual_display,node_display_manager,node_bonjour_advertiser toneAmber
class node_touch_input,node_video_decoder,node_metal_view,node_audio_player,node_screen_streamer,node_bitrate,node_input_injector toneMint
class node_network_client,node_network_host,node_mpc_client,node_mpc_host,node_client_crypto,node_host_crypto toneRose
class node_network toneIndigo
```

## Components

### iPad Client

- [Client Screens](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/ContentView.swift): `AirCatchClient/ContentView.swift`
- [Client Settings](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/ClientSettingsView.swift): `AirCatchClient/ClientSettingsView.swift`
- [Client Manager](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/ClientManager.swift): `AirCatchClient/ClientManager.swift`
- [Bonjour Discovery](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/BonjourBrowser.swift): `AirCatchClient/BonjourBrowser.swift`
- [Stream Overlay](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/VideoStreamOverlay.swift): `AirCatchClient/VideoStreamOverlay.swift`

### Mac Host

- [Host Controls](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/HostView.swift): `AirCatchHost/HostView.swift`
- [Host Manager](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/HostManager.swift): `AirCatchHost/HostManager.swift`
- [Virtual Display](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/VirtualDisplayManager.swift): `AirCatchHost/VirtualDisplayManager.swift`
- [Display Matching](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/DisplayManager.swift): `AirCatchHost/DisplayManager.swift`
- [Bonjour Advertisement](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/BonjourAdvertiser.swift): `AirCatchHost/BonjourAdvertiser.swift`

### Media and Input

- [Touch and Keyboard](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/MouseInputView.swift): `AirCatchClient/MouseInputView.swift`
- [Video Decoder](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/VideoDecoder.swift): `AirCatchClient/VideoDecoder.swift`
- [Metal Renderer](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/MetalVideoView.swift): `AirCatchClient/MetalVideoView.swift`
- [Audio Playback](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/AudioPlayer.swift): `AirCatchClient/AudioPlayer.swift`
- [Screen Capture and Encode](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/ScreenStreamer.swift): `AirCatchHost/ScreenStreamer.swift`
- [Bitrate Control](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/BitrateCalculator.swift): `AirCatchHost/BitrateCalculator.swift`
- [Native Input Injection](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/InputInjector.swift): `AirCatchHost/InputInjector.swift`

### Transport and Security

- [Client Networking](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/NetworkManager.swift): `AirCatchClient/NetworkManager.swift`
- [Host Networking](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/NetworkManager.swift): `AirCatchHost/NetworkManager.swift`
- [Client Control Channel](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/MPCAirCatchClient.swift): `AirCatchClient/MPCAirCatchClient.swift`
- [Host Control Channel](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/MPCAirCatchHost.swift): `AirCatchHost/MPCAirCatchHost.swift`
- [Client Cryptography](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchClient/CryptoManager.swift): `AirCatchClient/CryptoManager.swift`
- [Host Cryptography](https://github.com/tejaswikumar8352/aircatch/blob/main/AirCatchHost/CryptoManager.swift): `AirCatchHost/CryptoManager.swift`

### Other components

- **iPad User**
- **Mac User**
- **IP Network**

## Connections

- iPad User → Client Screens: chooses host (evidence: `README.md`)
- Client Screens → Client Manager: connects (evidence: `AirCatchClient/ContentView.swift`)
- Client Screens → Client Settings: opens settings (evidence: `AirCatchClient/ContentView.swift`)
- Client Manager → Bonjour Discovery: starts discovery (evidence: `AirCatchClient/ClientManager.swift`)
- Client Manager → Client Networking: exchanges packets (evidence: `README.md`)
- Client Manager → Client Control Channel: uses control channel (evidence: `README.md`)
- Client Manager → Client Cryptography: encrypts and authenticates (evidence: `README.md`)
- Client Manager → Stream Overlay: presents stream (evidence: `AirCatchClient/ContentView.swift`)
- Stream Overlay → Video Decoder: decodes frames (evidence: `AirCatchClient/VideoStreamOverlay.swift`)
- Video Decoder → Metal Renderer: renders frames (evidence: `README.md`)
- Stream Overlay → Touch and Keyboard: captures interaction (evidence: `AirCatchClient/VideoStreamOverlay.swift`)
- Touch and Keyboard → Client Manager: sends input (evidence: `AirCatchClient/MouseInputView.swift`)
- Client Manager → Audio Playback: plays decrypted audio (evidence: `AirCatchClient/ClientManager.swift`)
- Mac User → Host Controls: controls host (evidence: `README.md`)
- Host Controls → Host Manager: manages host (evidence: `AirCatchHost/HostView.swift`)
- Host Manager → Bonjour Advertisement: advertises service (evidence: `AirCatchHost/HostManager.swift`)
- Host Manager → Host Control Channel: handles control channel (evidence: `AirCatchHost/HostManager.swift`)
- Host Manager → Host Cryptography: authenticates sessions (evidence: `README.md`)
- Host Manager → Virtual Display: creates display (evidence: `AirCatchHost/HostManager.swift`)
- Host Manager → Screen Capture and Encode: starts capture (evidence: `AirCatchHost/HostManager.swift`)
- Host Manager → Display Matching: adjusts display mode (evidence: `AirCatchHost/HostManager.swift`)
- Host Manager → Bitrate Control: adapts bitrate (evidence: `AirCatchHost/HostManager.swift`)
- Host Manager → Native Input Injection: dispatches input (evidence: `AirCatchHost/HostManager.swift`)
- Screen Capture and Encode → Host Networking: sends encoded media (evidence: `README.md`)
- Host Networking → IP Network: transfers encrypted packets (evidence: `README.md`)
- Client Networking → IP Network: receives packets (evidence: `README.md`)
- IP Network → Bonjour Advertisement: discovers host (evidence: `README.md`)
- IP Network → Native Input Injection: carries control packets (evidence: `README.md`)
- Native Input Injection → Host Manager: reports native events (evidence: `AirCatchHost/HostManager.swift`)
