# spaceunlimited/privacy-invading-smart-glasses-halloween-costume architecture

> Architecture diagram of the GitHub repository spaceunlimited/privacy-invading-smart-glasses-halloween-costume, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume
- Repository: https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume

## Overview

#### Purpose and Platform
A native SwiftUI iPad/iOS costume-prop app that presents a live camera feed and on-device Apple Speech transcription in a “smart glasses” display. It uses Apple frameworks rather than a backend or custom external service. Project entry/build definition is `Privacy Invading Smart Glasses.xcodeproj/project.pbxproj`; runtime privacy declarations are expected in `Privacy-Invading-Smart-Glasses-Info.plist`.

#### Application Entry and Composition
`Privacy Invading Smart Glasses/Privacy_Invading_Smart_GlassesApp.swift` is the SwiftUI application entry point and creates the root UI. `Privacy Invading Smart Glasses/ContentView.swift` composes the primary screen, connecting camera and speech state to the glass-style interface. This is a single-client app with no server-side layer evident.

#### Camera Capture Domain
`Privacy Invading Smart Glasses/CameraManager.swift` owns camera discovery, capture-session lifecycle, permission handling, and switching between available cameras. It is the boundary to AVFoundation and must accommodate both built-in cameras and externally attached USB/UVC devices as exposed by iPadOS. Camera control/state should remain centralized here rather than embedded in SwiftUI views.

#### Camera Rendering Boundary
`Privacy Invading Smart Glasses/CameraPreviewView.swift` adapts the AVFoundation camera preview into the SwiftUI hierarchy. The control path is UI action → `CameraManager` session/device update → preview-layer output → SwiftUI-hosted preview. This separation keeps capture/session work outside declarative rendering and permits UI overlays without altering the video pipeline.

#### Speech Recognition Domain
`Privacy Invading Smart Glasses/SpeechRecognitionManager.swift` encapsulates authorization, audio capture/recognition lifecycle, and live transcription state using Apple’s Speech framework. Its flow is microphone input → Speech recognition request/task → recognized text published to the UI. Speech is a distinct permission and runtime boundary from camera capture, despite both being surfaced by `ContentView`.

#### UI State and User Interaction
`Privacy Invading Smart Glasses/ContentView.swift` is the orchestration surface for the live preview, transcription display, camera-selection controls, and visual glass treatment. It should observe manager-owned state and issue high-level start/stop/switch commands; it should not directly manage AVFoundation sessions or Speech recognition tasks.

#### Runtime and Device Dependencies
Material dependencies are SwiftUI for presentation, AVFoundation for video capture, and Speech for transcription; microphone/audio capture is implicitly required by the Speech pipeline. The app depends on iPadOS device permissions for camera, microphone, and speech recognition, plus physical USB-C power/data infrastructure when using external webcams. Asset branding is contained in `Privacy Invading Smart Glasses/Assets.xcassets`.

Main entry points: [`Privacy Invading Smart Glasses/ContentView.swift`](https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/ContentView.swift) (Smart Glasses Screen), [`Privacy Invading Smart Glasses/CameraManager.swift`](https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/CameraManager.swift) (Camera Manager), [`Privacy Invading Smart Glasses/SpeechRecognitionManager.swift`](https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/SpeechRecognitionManager.swift) (Speech Manager), [`Privacy Invading Smart Glasses/CameraPreviewView.swift`](https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/CameraPreviewView.swift) (Camera Preview)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["SwiftUI App"]
  node_project["Xcode Project<br/>build definition<br/>[project.pbxproj]"]
  node_app_entry["App Entry<br/>SwiftUI app"]
  node_content_view["Smart Glasses Screen<br/>root SwiftUI view<br/>[ContentView.swift]"]
  node_assets["Brand Assets<br/>asset catalog<br/>[Assets.xcassets]"]
end

subgraph group_camera["Camera Capture"]
  node_camera_manager["Camera Manager<br/>capture controller"]
  node_camera_preview["Camera Preview<br/>SwiftUI AV adapter"]
  node_camera_devices{{"Built-in / USB Cameras<br/>video input devices"}}
end

subgraph group_speech["Live Transcription"]
  node_speech_manager["Speech Manager<br/>recognition controller"]
  node_microphone{{"Microphone Input<br/>audio input"}}
end

subgraph group_platform["iPadOS Frameworks"]
  node_speech_recognition["Apple Speech<br/>recognition framework"]
  node_avfoundation["AVFoundation<br/>capture framework"]
  node_swiftui["SwiftUI<br/>presentation framework"]
  node_permissions["iPadOS Permissions<br/>runtime privacy boundary"]
end

node_project -->|"builds"| node_app_entry
node_app_entry -->|"creates"| node_content_view
node_content_view -->|"camera commands/state"| node_camera_manager
node_content_view -->|"hosts"| node_camera_preview
node_content_view -->|"speech commands/text"| node_speech_manager
node_content_view -->|"uses"| node_assets
node_camera_manager -->|"discovers and selects"| node_camera_devices
node_camera_manager -->|"manages capture session"| node_avfoundation
node_camera_manager -->|"preview-layer output"| node_camera_preview
node_camera_preview -->|"adapts into"| node_swiftui
node_speech_manager -->|"captures audio"| node_microphone
node_speech_manager -->|"submits recognition request"| node_speech_recognition
node_speech_recognition -->|"recognized text"| node_content_view
node_camera_manager -.->|"requests camera access"| node_permissions
node_speech_manager -.->|"requests microphone and speech access"| node_permissions

click node_project "https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses.xcodeproj/project.pbxproj"
click node_app_entry "https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/Privacy_Invading_Smart_GlassesApp.swift"
click node_content_view "https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/ContentView.swift"
click node_assets "https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/tree/main/Privacy%20Invading%20Smart%20Glasses/Assets.xcassets"
click node_camera_manager "https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/CameraManager.swift"
click node_camera_preview "https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/CameraPreviewView.swift"
click node_speech_manager "https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/SpeechRecognitionManager.swift"
click node_permissions "https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy-Invading-Smart-Glasses-Info.plist"

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_project,node_app_entry,node_content_view,node_assets toneBlue
class node_camera_manager,node_camera_preview,node_camera_devices toneAmber
class node_speech_manager,node_microphone toneMint
class node_speech_recognition,node_avfoundation,node_swiftui,node_permissions toneRose
```

## Components

### SwiftUI App

- [Xcode Project](https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses.xcodeproj/project.pbxproj): build definition · `Privacy Invading Smart Glasses.xcodeproj/project.pbxproj`
- [App Entry](https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/Privacy_Invading_Smart_GlassesApp.swift): SwiftUI app · `Privacy Invading Smart Glasses/Privacy_Invading_Smart_GlassesApp.swift`
- [Smart Glasses Screen](https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/ContentView.swift): root SwiftUI view · Composes preview, transcription, and camera controls. · `Privacy Invading Smart Glasses/ContentView.swift`
- [Brand Assets](https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/tree/main/Privacy%20Invading%20Smart%20Glasses/Assets.xcassets): asset catalog · `Privacy Invading Smart Glasses/Assets.xcassets`

### Camera Capture

- [Camera Manager](https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/CameraManager.swift): capture controller · Owns camera permission, session lifecycle, and device switching. · `Privacy Invading Smart Glasses/CameraManager.swift`
- [Camera Preview](https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/CameraPreviewView.swift): SwiftUI AV adapter · Hosts the AVFoundation preview layer in SwiftUI. · `Privacy Invading Smart Glasses/CameraPreviewView.swift`
- **Built-in / USB Cameras**: video input devices · Includes iPad cameras and attached UVC webcams exposed by iPadOS.

### Live Transcription

- [Speech Manager](https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy%20Invading%20Smart%20Glasses/SpeechRecognitionManager.swift): recognition controller · Owns authorization, audio capture, and live recognition lifecycle. · `Privacy Invading Smart Glasses/SpeechRecognitionManager.swift`
- **Microphone Input**: audio input

### iPadOS Frameworks

- **Apple Speech**: recognition framework
- **AVFoundation**: capture framework
- **SwiftUI**: presentation framework
- [iPadOS Permissions](https://github.com/spaceunlimited/privacy-invading-smart-glasses-halloween-costume/blob/main/Privacy-Invading-Smart-Glasses-Info.plist): runtime privacy boundary · Camera, microphone, and speech-recognition access. · `Privacy-Invading-Smart-Glasses-Info.plist`

## Connections

- Xcode Project → App Entry: builds
- App Entry → Smart Glasses Screen: creates
- Smart Glasses Screen → Camera Manager: camera commands/state
- Smart Glasses Screen → Camera Preview: hosts
- Smart Glasses Screen → Speech Manager: speech commands/text
- Smart Glasses Screen → Brand Assets: uses
- Camera Manager → Built-in / USB Cameras: discovers and selects
- Camera Manager → AVFoundation: manages capture session
- Camera Manager → Camera Preview: preview-layer output
- Camera Preview → SwiftUI: adapts into
- Speech Manager → Microphone Input: captures audio
- Speech Manager → Apple Speech: submits recognition request
- Apple Speech → Smart Glasses Screen: recognized text
- Camera Manager → iPadOS Permissions: requests camera access
- Speech Manager → iPadOS Permissions: requests microphone and speech access
