# luksmoreira/freephoto architecture

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

- Interactive diagram: https://gitdiagram.com/luksmoreira/freephoto
- Repository: https://github.com/luksmoreira/freephoto

## Overview

FreePhoto is a native iOS camera app. The user selects a physical lens and capture format, optionally applies manual camera controls, takes a photo, and receives a local original plus a JSON report; the app also attempts to add the image to Photos and offers sharing. The excerpts show the SwiftUI entry point, UI-to-engine use, and parts of capture and saving. Other engine responsibilities are included where the README documents them; their internal call relationships were not fully sampled.

Main entry points: [`FreePhoto/CameraEngine.swift`](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift) (Camera engine), [`FreePhoto/CameraView.swift`](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraView.swift) (Camera screen), [`FreePhoto/FreePhotoApp.swift`](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/FreePhotoApp.swift) (App entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["App interface"]
  node_app["App entry<br/>[FreePhotoApp.swift]"]
  node_camera_view["Camera screen<br/>[CameraView.swift]"]
  node_manual_ui["Manual controls UI<br/>[CameraView.swift]"]
  node_preview["Camera preview<br/>[CameraView.swift]"]
end

subgraph group_camera["Camera and capture"]
  node_engine["Camera engine<br/>[CameraEngine.swift]"]
  node_lens_discovery["Lens discovery<br/>[CameraEngine.swift]"]
  node_session["Camera session<br/>[CameraEngine.swift]"]
  node_format_controls["Format and controls<br/>[CameraEngine.swift]"]
  node_photo_capture["Photo capture<br/>[CameraEngine.swift]"]
  node_format_encoding["Format encoding<br/>[CameraEngine.swift]"]
end

subgraph group_output["Photo outputs"]
  node_local_files[("Local originals<br/>[CameraEngine.swift]")]
  node_json_report["Capture report<br/>[CameraEngine.swift]"]
  node_photos_library[("Photos library")]
  node_sharing["Original sharing<br/>[CameraView.swift]"]
end

node_user(("Photographer"))
node_camera_device["iOS camera"]

node_app -->|"opens"| node_camera_view
node_user -->|"operates"| node_camera_view
node_camera_view -->|"starts and controls"| node_engine
node_camera_view -->|"opens controls"| node_manual_ui
node_camera_view -->|"displays preview"| node_preview
node_camera_view -->|"selects lens and mode"| node_engine
node_manual_ui -->|"applies settings"| node_engine
node_engine -->|"discovers cameras"| node_lens_discovery
node_engine -->|"manages session"| node_session
node_session -->|"configures camera"| node_camera_device
node_engine -->|"checks capabilities"| node_format_controls
node_engine -->|"dispatches capture"| node_photo_capture
node_photo_capture -->|"requests photo"| node_camera_device
node_photo_capture -->|"processes selected format"| node_format_encoding
node_engine -->|"writes original"| node_local_files
node_engine -->|"writes dimensions and metadata"| node_json_report
node_engine -->|"imports saved image"| node_photos_library
node_camera_view -->|"offers original sharing"| node_sharing
node_sharing -->|"shares saved original"| node_local_files

click node_app "https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/FreePhotoApp.swift"
click node_camera_view "https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraView.swift"
click node_manual_ui "https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraView.swift"
click node_preview "https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraView.swift"
click node_engine "https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift"
click node_lens_discovery "https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift"
click node_session "https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift"
click node_format_controls "https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift"
click node_photo_capture "https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift"
click node_format_encoding "https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift"
click node_local_files "https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift"
click node_json_report "https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift"
click node_sharing "https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraView.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,node_camera_view,node_manual_ui,node_preview toneBlue
class node_engine,node_lens_discovery,node_session,node_format_controls,node_photo_capture,node_format_encoding toneAmber
class node_local_files,node_json_report,node_photos_library,node_sharing toneMint
class node_user,node_camera_device toneIndigo
```

## Components

### App interface

- [App entry](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/FreePhotoApp.swift): `FreePhoto/FreePhotoApp.swift`
- [Camera screen](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraView.swift): `FreePhoto/CameraView.swift`
- [Manual controls UI](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraView.swift): `FreePhoto/CameraView.swift`
- [Camera preview](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraView.swift): `FreePhoto/CameraView.swift`

### Camera and capture

- [Camera engine](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift): `FreePhoto/CameraEngine.swift`
- [Lens discovery](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift): `FreePhoto/CameraEngine.swift`
- [Camera session](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift): `FreePhoto/CameraEngine.swift`
- [Format and controls](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift): `FreePhoto/CameraEngine.swift`
- [Photo capture](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift): `FreePhoto/CameraEngine.swift`
- [Format encoding](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift): `FreePhoto/CameraEngine.swift`

### Photo outputs

- [Local originals](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift): `FreePhoto/CameraEngine.swift`
- [Capture report](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraEngine.swift): `FreePhoto/CameraEngine.swift`
- **Photos library**
- [Original sharing](https://github.com/luksmoreira/freephoto/blob/main/FreePhoto/CameraView.swift): `FreePhoto/CameraView.swift`

### Other components

- **Photographer**
- **iOS camera**

## Connections

- App entry → Camera screen: opens (evidence: `FreePhoto/FreePhotoApp.swift`)
- Photographer → Camera screen: operates (evidence: `README.md`)
- Camera screen → Camera engine: starts and controls (evidence: `FreePhoto/CameraView.swift`)
- Camera screen → Manual controls UI: opens controls (evidence: `FreePhoto/CameraView.swift`)
- Camera screen → Camera preview: displays preview (evidence: `FreePhoto/CameraView.swift`)
- Camera screen → Camera engine: selects lens and mode (evidence: `FreePhoto/CameraView.swift`)
- Manual controls UI → Camera engine: applies settings (evidence: `FreePhoto/CameraView.swift`)
- Camera engine → Lens discovery: discovers cameras (evidence: `README.md`)
- Camera engine → Camera session: manages session (evidence: `FreePhoto/CameraEngine.swift`)
- Camera session → iOS camera: configures camera (evidence: `FreePhoto/CameraEngine.swift`)
- Camera engine → Format and controls: checks capabilities (evidence: `FreePhoto/CameraEngine.swift`)
- Camera engine → Photo capture: dispatches capture (evidence: `FreePhoto/CameraEngine.swift`)
- Photo capture → iOS camera: requests photo (evidence: `FreePhoto/CameraEngine.swift`)
- Photo capture → Format encoding: processes selected format (evidence: `README.md`)
- Camera engine → Local originals: writes original (evidence: `FreePhoto/CameraEngine.swift`)
- Camera engine → Capture report: writes dimensions and metadata (evidence: `README.md`)
- Camera engine → Photos library: imports saved image (evidence: `FreePhoto/CameraEngine.swift`)
- Camera screen → Original sharing: offers original sharing (evidence: `README.md`)
- Original sharing → Local originals: shares saved original (evidence: `README.md`)
