# lakr233/notchdrop architecture

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

- Interactive diagram: https://gitdiagram.com/lakr233/notchdrop
- Repository: https://github.com/lakr233/notchdrop

## Overview

##### Project type and purpose
- NotchDrop is a native macOS desktop application written in Swift (Xcode project).
- Its goal is to turn the MacBook notch into a drag-and-drop file zone, with a small menu-bar component, a notch overlay window, and local persistence (one-day cache).

##### File structure
- Top-level Xcode project files (NotchDrop.xcodeproj, Info.plist, entitlements).
- Source directory “NotchDrop/” containing:
- App entry points: main.swift, AppDelegate.swift
- UI components: NotchWindow*, NotchWindowController, NotchContentView, NotchMenuView, NotchSettingsView, TrayDrop*
- View model & event logic: NotchViewModel+Events.swift, NotchViewModel.swift, EventMonitor.swift, EventMonitors.swift
- Persistence helper: PublishedPersist.swift
- Extensions for convenience: Ext+FileProvider.swift, Ext+NSAlert.swift, etc.
- Share logic: Share.swift, Share+View.swift
- Resources: assets, localization, helper scripts, privacy docs.

##### README for additional insights
- Confirms it’s purely client-side (no external backend).
- Highlights integration with menu-bar managers, AirDrop, local caching.

##### Detail
- Every View and ViewModel class in the UI/logic layers.
- EventMonitor subsystem as a distinct component.
- One-day cache TTL logic in the persistence layer.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User
    User["User"]:::external

    %% Application Host
    subgraph "Application Host"
        HostMain["main.swift"]:::host
        HostAppDel["AppDelegate.swift"]:::host
    end

    %% UI Layer
    subgraph "UI Layer"
        TrayDrop["TrayDrop"]:::ui
        TrayDropView["TrayDrop+View"]:::ui
        TrayDropDropItem["TrayDrop+DropItem"]:::ui
        TrayDropDropItemView["TrayDrop+DropItemView"]:::ui

        NotchWindow["NotchWindow"]:::ui
        NotchWindowController["NotchWindowController"]:::ui

        NotchContentView["NotchContentView"]:::ui
        NotchMenuView["NotchMenuView"]:::ui
        NotchSettingsView["NotchSettingsView"]:::ui
        ShareView["Share+View"]:::ui
        NotchHeaderView["NotchHeaderView"]:::ui
        NotchViewUI["NotchView"]:::ui
        NotchViewController["NotchViewController"]:::ui
    end

    %% Presentation / Logic Layer
    subgraph "Presentation / Logic"
        NotchVM["NotchViewModel"]:::logic
        NotchVMEvents["NotchViewModel+Events"]:::logic
        EventMonitor["EventMonitor"]:::logic
        EventMonitors["EventMonitors"]:::logic
        ShareLogic["Share.swift"]:::logic
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        PublishedPersist["PublishedPersist"]:::persistence
        FileSystem["File System (tmp drop folder)"]:::persistence
    end

    %% External / OS Services
    subgraph "External / OS Services"
        ExtFileProv["Ext+FileProvider"]:::external
        ExtNSAlert["Ext+NSAlert"]:::external
        ExtNSImage["Ext+NSImage"]:::external
        ExtNSScreen["Ext+NSScreen"]:::external
        ExtURL["Ext+URL"]:::external
        FileMgr["FileManager / NSWorkspace"]:::external
        AirDrop["AirDrop"]:::external
        NotificationCenter["NotificationCenter"]:::external
    end

    %% Connections
    User -->|"drops file"| TrayDrop
    User -->|"drops file"| NotchWindow

    TrayDrop -->|"view binds to"| NotchVM
    TrayDropView -->|"view binds to"| NotchVM
    TrayDropDropItemView -->|"view binds to"| NotchVM
    NotchContentView -->|"view binds to"| NotchVM
    NotchMenuView -->|"view binds to"| NotchVM
    NotchSettingsView -->|"view binds to"| NotchVM
    ShareView -->|"view binds to"| NotchVM
    NotchViewUI -->|"view binds to"| NotchVM
    NotchViewController -->|"controls view"| NotchVM

    EventMonitor -->|"drop event→"| NotchVMEvents
    EventMonitors -->|"aggregates events"| EventMonitor
    NotchVMEvents -->|"updates state"| NotchVM

    NotchVM -->|"writes to"| PublishedPersist
    PublishedPersist -->|"persists to"| FileSystem
    PublishedPersist -->|"timer purge TTL"| FileSystem

    NotchVM -->|"open file via"| FileMgr
    NotchVM -->|"share via"| AirDrop

    NotchVM -->|"uses helpers"| ExtFileProv
    NotchVM -->|"uses helpers"| ExtNSAlert
    NotchVM -->|"uses helpers"| ExtNSImage
    NotchVM -->|"uses helpers"| ExtNSScreen
    NotchVM -->|"uses helpers"| ExtURL

    NotificationCenter -->|"notifies"| NotchVM

    HostMain -->|"launches"| HostAppDel
    HostAppDel -->|"initializes"| TrayDrop
    HostAppDel -->|"initializes"| NotchWindow

    %% Click Events
    click HostMain "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/main.swift"
    click HostAppDel "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/AppDelegate.swift"
    click TrayDrop "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/TrayDrop.swift"
    click TrayDropView "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/TrayDrop+View.swift"
    click TrayDropDropItem "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/TrayDrop+DropItem.swift"
    click TrayDropDropItemView "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/TrayDrop+DropItemView.swift"
    click NotchWindow "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/NotchWindow.swift"
    click NotchWindowController "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/NotchWindowController.swift"
    click NotchContentView "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/NotchContentView.swift"
    click NotchMenuView "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/NotchMenuView.swift"
    click NotchSettingsView "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/NotchSettingsView.swift"
    click ShareView "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/Share+View.swift"
    click NotchHeaderView "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/NotchHeaderView.swift"
    click NotchViewUI "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/NotchView.swift"
    click NotchViewController "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/NotchViewController.swift"
    click NotchVM "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/NotchViewModel.swift"
    click NotchVMEvents "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/NotchViewModel+Events.swift"
    click EventMonitor "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/EventMonitor.swift"
    click EventMonitors "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/EventMonitors.swift"
    click PublishedPersist "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/PublishedPersist.swift"
    click ExtFileProv "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/Ext+FileProvider.swift"
    click ExtNSAlert "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/Ext+NSAlert.swift"
    click ExtNSImage "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/Ext+NSImage.swift"
    click ExtNSScreen "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/Ext+NSScreen.swift"
    click ExtURL "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/Ext+URL.swift"
    click ShareLogic "https://github.com/lakr233/notchdrop/blob/main/NotchDrop/Share.swift"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#3399ff,color:#000;
    classDef logic fill:#d4edda,stroke:#28a745,color:#000;
    classDef persistence fill:#fff3cd,stroke:#ffcc00,color:#000;
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#000;
    classDef host fill:#f0e6f7,stroke:#8e44ad,color:#000;
```
