# x6one/hashiya-ios architecture

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

- Interactive diagram: https://gitdiagram.com/x6one/hashiya-ios
- Repository: https://github.com/x6one/hashiya-ios

## Overview

Tayya is a local-first iPhone and iPad study app. Users import PDFs or Office files into a sectioned library, open a notebook to read and annotate its PDF, and manage page-linked notes, audio, search, and study cards. Office files can be previewed and converted locally to PDF; backups and recovery support the library. The graph covers documented capabilities and source-index relationships; some feature implementations were not sampled, so their internal links are omitted rather than inferred.

Main entry points: [`App/LibraryScreen.swift`](https://github.com/x6one/hashiya-ios/blob/main/App/LibraryScreen.swift) (Library browser), [`App/PDFWorkspace.swift`](https://github.com/x6one/hashiya-ios/blob/main/App/PDFWorkspace.swift) (PDF workspace), [`App/AppEntrance.swift`](https://github.com/x6one/hashiya-ios/blob/main/App/AppEntrance.swift) (App entry), [`App/LibraryStore.swift`](https://github.com/x6one/hashiya-ios/blob/main/App/LibraryStore.swift) (Library store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_library["Library"]
  node_app["App entry<br/>[AppEntrance.swift]"]
  node_library_ui["Library browser"]
  node_store[("Library store<br/>[LibraryStore.swift]")]
  node_picker["Files picker"]
  node_import["Document validation"]
  node_search["Library search"]
  node_theme["App theme<br/>[TayyaTheme.swift]"]
end

subgraph group_study["PDF Study"]
  node_workspace["PDF workspace<br/>[PDFWorkspace.swift]"]
  node_ink["Ink controls<br/>[InkSelection.swift]"]
  node_page_edit["Page removal"]
end

subgraph group_notes["Notes and Audio"]
  node_margin_ui["Margin pane<br/>[MarginPane.swift]"]
  node_margin_store[("Margin pages<br/>[MarginPages.swift]")]
  node_margin_canvas["Margin canvas"]
  node_audio[("Page audio<br/>[PageAudio.swift]")]
  node_audio_links["Audio links<br/>[AudioLinks.swift]"]
  node_cards["Flashcards<br/>[Flashcards.swift]"]
end

subgraph group_office["Office Documents"]
  node_office_search["Office text search<br/>[OfficeSearch.swift]"]
  node_office_view["Office preview"]
  node_office_convert["Office conversion"]
  node_native_engine["Native Office engine"]
end

subgraph group_support["Backup and Recovery"]
  node_backup_ui["Backup interface<br/>[BackupScreen.swift]"]
  node_backup[("Backup and restore")]
end

node_user(("Reader"))

node_user -->|"opens"| node_app
node_app -->|"shows"| node_library_ui
node_library_ui -->|"manages"| node_store
node_library_ui -.->|"selects files"| node_picker
node_library_ui -->|"imports"| node_import
node_store -->|"validates"| node_import
node_user -->|"browses"| node_library_ui
node_library_ui -.->|"opens notebook"| node_workspace
node_library_ui -->|"queries"| node_search
node_search -->|"extracts text"| node_office_search
node_workspace -.->|"configures ink"| node_ink
node_workspace -->|"deletes pages"| node_page_edit
node_workspace -->|"shows margins"| node_margin_ui
node_margin_ui -->|"edits pages"| node_margin_store
node_margin_ui -.->|"uses canvas"| node_margin_canvas
node_workspace -.->|"records audio"| node_audio
node_audio_links -.->|"links clips"| node_audio
node_workspace -.->|"opens cards"| node_cards
node_store -.->|"opens document"| node_office_view
node_office_view -.->|"requests conversion"| node_office_convert
node_office_convert -.->|"converts locally"| node_native_engine
node_library_ui -->|"opens backup"| node_backup_ui
node_backup_ui -.->|"backs up library"| node_backup
node_backup -.->|"preserves edits"| node_page_edit
node_app -->|"uses theme"| node_theme

click node_app "https://github.com/x6one/hashiya-ios/blob/main/App/AppEntrance.swift"
click node_library_ui "https://github.com/x6one/hashiya-ios/blob/main/App/LibraryScreen.swift"
click node_store "https://github.com/x6one/hashiya-ios/blob/main/App/LibraryStore.swift"
click node_picker "https://github.com/x6one/hashiya-ios/blob/main/App/DocumentPicker.swift"
click node_import "https://github.com/x6one/hashiya-ios/blob/main/App/DocumentImport.swift"
click node_search "https://github.com/x6one/hashiya-ios/blob/main/App/LibrarySearch.swift"
click node_office_search "https://github.com/x6one/hashiya-ios/blob/main/App/OfficeSearch.swift"
click node_workspace "https://github.com/x6one/hashiya-ios/blob/main/App/PDFWorkspace.swift"
click node_ink "https://github.com/x6one/hashiya-ios/blob/main/App/InkSelection.swift"
click node_page_edit "https://github.com/x6one/hashiya-ios/blob/main/App/DocumentPageRemoval.swift"
click node_margin_ui "https://github.com/x6one/hashiya-ios/blob/main/App/MarginPane.swift"
click node_margin_store "https://github.com/x6one/hashiya-ios/blob/main/App/MarginPages.swift"
click node_margin_canvas "https://github.com/x6one/hashiya-ios/blob/main/App/MarginNotebook.swift"
click node_audio "https://github.com/x6one/hashiya-ios/blob/main/App/PageAudio.swift"
click node_audio_links "https://github.com/x6one/hashiya-ios/blob/main/App/AudioLinks.swift"
click node_cards "https://github.com/x6one/hashiya-ios/blob/main/App/Flashcards.swift"
click node_office_view "https://github.com/x6one/hashiya-ios/blob/main/App/OfficeDocument.swift"
click node_office_convert "https://github.com/x6one/hashiya-ios/blob/main/App/OfficeConversion.swift"
click node_native_engine "https://github.com/x6one/hashiya-ios/blob/main/NativeOffice/OfficeEngineBridge.mm"
click node_backup_ui "https://github.com/x6one/hashiya-ios/blob/main/App/BackupScreen.swift"
click node_backup "https://github.com/x6one/hashiya-ios/blob/main/App/LibraryBackup.swift"
click node_theme "https://github.com/x6one/hashiya-ios/blob/main/App/TayyaTheme.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_library_ui,node_store,node_picker,node_import,node_search,node_theme toneBlue
class node_workspace,node_ink,node_page_edit toneAmber
class node_margin_ui,node_margin_store,node_margin_canvas,node_audio,node_audio_links,node_cards toneMint
class node_office_search,node_office_view,node_office_convert,node_native_engine toneRose
class node_backup_ui,node_backup,node_user toneIndigo
```

## Components

### Library

- [App entry](https://github.com/x6one/hashiya-ios/blob/main/App/AppEntrance.swift): `App/AppEntrance.swift`
- [Library browser](https://github.com/x6one/hashiya-ios/blob/main/App/LibraryScreen.swift): `App/LibraryScreen.swift`
- [Library store](https://github.com/x6one/hashiya-ios/blob/main/App/LibraryStore.swift): `App/LibraryStore.swift`
- [Files picker](https://github.com/x6one/hashiya-ios/blob/main/App/DocumentPicker.swift): `App/DocumentPicker.swift`
- [Document validation](https://github.com/x6one/hashiya-ios/blob/main/App/DocumentImport.swift): `App/DocumentImport.swift`
- [Library search](https://github.com/x6one/hashiya-ios/blob/main/App/LibrarySearch.swift): `App/LibrarySearch.swift`
- [App theme](https://github.com/x6one/hashiya-ios/blob/main/App/TayyaTheme.swift): `App/TayyaTheme.swift`

### PDF Study

- [PDF workspace](https://github.com/x6one/hashiya-ios/blob/main/App/PDFWorkspace.swift): `App/PDFWorkspace.swift`
- [Ink controls](https://github.com/x6one/hashiya-ios/blob/main/App/InkSelection.swift): `App/InkSelection.swift`
- [Page removal](https://github.com/x6one/hashiya-ios/blob/main/App/DocumentPageRemoval.swift): `App/DocumentPageRemoval.swift`

### Notes and Audio

- [Margin pane](https://github.com/x6one/hashiya-ios/blob/main/App/MarginPane.swift): `App/MarginPane.swift`
- [Margin pages](https://github.com/x6one/hashiya-ios/blob/main/App/MarginPages.swift): `App/MarginPages.swift`
- [Margin canvas](https://github.com/x6one/hashiya-ios/blob/main/App/MarginNotebook.swift): `App/MarginNotebook.swift`
- [Page audio](https://github.com/x6one/hashiya-ios/blob/main/App/PageAudio.swift): `App/PageAudio.swift`
- [Audio links](https://github.com/x6one/hashiya-ios/blob/main/App/AudioLinks.swift): `App/AudioLinks.swift`
- [Flashcards](https://github.com/x6one/hashiya-ios/blob/main/App/Flashcards.swift): `App/Flashcards.swift`

### Office Documents

- [Office text search](https://github.com/x6one/hashiya-ios/blob/main/App/OfficeSearch.swift): `App/OfficeSearch.swift`
- [Office preview](https://github.com/x6one/hashiya-ios/blob/main/App/OfficeDocument.swift): `App/OfficeDocument.swift`
- [Office conversion](https://github.com/x6one/hashiya-ios/blob/main/App/OfficeConversion.swift): `App/OfficeConversion.swift`
- [Native Office engine](https://github.com/x6one/hashiya-ios/blob/main/NativeOffice/OfficeEngineBridge.mm): `NativeOffice/OfficeEngineBridge.mm`

### Backup and Recovery

- [Backup interface](https://github.com/x6one/hashiya-ios/blob/main/App/BackupScreen.swift): `App/BackupScreen.swift`
- [Backup and restore](https://github.com/x6one/hashiya-ios/blob/main/App/LibraryBackup.swift): `App/LibraryBackup.swift`

### Other components

- **Reader**

## Connections

- Reader → App entry: opens (evidence: `App/AppEntrance.swift`)
- App entry → Library browser: shows (evidence: `App/AppEntrance.swift`)
- Library browser → Library store: manages (evidence: `App/LibraryScreen.swift`)
- Library browser → Files picker: selects files (evidence: `App/LibraryScreen.swift`)
- Library browser → Document validation: imports (evidence: `App/LibraryScreen.swift`)
- Library store → Document validation: validates (evidence: `App/LibraryStore.swift`)
- Reader → Library browser: browses (evidence: `App/LibraryScreen.swift`)
- Library browser → PDF workspace: opens notebook
- Library browser → Library search: queries (evidence: `App/LibraryScreen.swift`)
- Library search → Office text search: extracts text (evidence: `App/LibrarySearch.swift`)
- PDF workspace → Ink controls: configures ink (evidence: `App/PDFWorkspace.swift`)
- PDF workspace → Page removal: deletes pages (evidence: `App/PDFWorkspace.swift`)
- PDF workspace → Margin pane: shows margins (evidence: `App/PDFWorkspace.swift`)
- Margin pane → Margin pages: edits pages (evidence: `App/MarginPane.swift`)
- Margin pane → Margin canvas: uses canvas (evidence: `App/MarginPane.swift`)
- PDF workspace → Page audio: records audio (evidence: `App/PDFWorkspace.swift`)
- Audio links → Page audio: links clips (evidence: `App/AudioLinks.swift`)
- PDF workspace → Flashcards: opens cards
- Library store → Office preview: opens document (evidence: `App/OfficeDocument.swift`)
- Office preview → Office conversion: requests conversion (evidence: `App/OfficeDocument.swift`)
- Office conversion → Native Office engine: converts locally
- Library browser → Backup interface: opens backup (evidence: `App/LibraryScreen.swift`)
- Backup interface → Backup and restore: backs up library
- Backup and restore → Page removal: preserves edits (evidence: `App/LibraryBackup.swift`)
- App entry → App theme: uses theme (evidence: `App/AppEntrance.swift`)
