# bengerthelorf/maciconchanger architecture

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

- Interactive diagram: https://gitdiagram.com/bengerthelorf/maciconchanger
- Repository: https://github.com/bengerthelorf/maciconchanger

## Overview

##### Main Components
- GUI Application (IconChanger):
- This is the core macOS app built with Swift and Xcode.
- It includes UI components (e.g., ContentView.swift, ChangeView.swift, various SettingsView files) for the main functionality.
- CLI Tool (IconChangerCLI):
- Additional modules like AliasName and ImageView handle auxiliary tasks (e.g., aliasing app names and viewing image details).
- Configuration and Settings:
- Config.swift and the Config directory (including ConfigManager.swift and its CLI extension) handle settings, configuration import/export, and persistent preferences.
- Settings views in the SettingsView folder illustrate the GUI aspect for these features.
- Background Service:
- External Integrations:
- Integration points for the API (requiring an API key from macosicons.com) and dotfiles automation (as described in the README) should be identified.

##### Relationships and Interactions
- External integrations (e.g., API key management and dotfiles scripts) feed into the configuration and update processes.

##### Architectural Patterns and Key Technologies
- While the project might follow patterns like MVVM or MVC, emphasize the separation of concerns by detailing:
- UI rendering and user interaction in the GUI layer.
- Coordination between GUI and business logic as the “controller.”
- Technologies:
- Swift for the core application.
- Xcode (with .xcodeproj files) as the development environment.
- macOS-specific APIs and frameworks for app functionality.
- Command-line scripts and shell commands for dotfiles integration.

##### Additional Details
- How the CLI tool installation is facilitated via the GUI, and how it integrates with the underlying logic.

## Diagram (Mermaid)

```mermaid
graph TD
    %% GUI Application Layer
    subgraph "GUI Application"
        AppDelegate["AppDelegate.swift"]:::gui
        IconChangerApp["IconChangerApp.swift"]:::gui
        ContentView["ContentView.swift"]:::gui
        ChangeView["ChangeView.swift"]:::gui
        SettingsView["SettingsView (Directory)"]:::gui
    end

    %% CLI Tool Layer
    subgraph "CLI Tool"
        CLI_Tool["IconChangerCLI.swift"]:::cli
        CLI_Manager["CLIManager.swift"]:::cli
    end

    %% Business Logic & Icon Management
    subgraph "Business Logic & Icon Management"
        Icon_Manager["IconManager.swift"]:::biz
        Icon_Cache["IconCache.swift"]:::biz
        Icon_List["IconList.swift"]:::biz
        Icon_Resource["IconRes.swift"]:::biz
        AliasName["AliasName Modules"]:::biz
        ImageView["ImageView Modules"]:::biz
    end

    %% Configuration & Settings
    subgraph "Configuration & Settings"
        Config_Module["Config.swift & Config Directory"]:::config
        Config_CLI["ConfigManager+CLI.swift"]:::config
    end

    %% Background Service Layer
    subgraph "Background Service"
        BackgroundService["BackgroundService.swift"]:::bg
        AutoUpdater["AutoUpdater.swift"]:::bg
    end

    %% External Integrations
    subgraph "External Integrations"
        External["API & Dotfiles Automation"]:::ext
    end

    %% Relationships between layers
    AppDelegate -->|"launches"| IconChangerApp
    IconChangerApp -->|"renders"| ContentView
    IconChangerApp -->|"renders"| ChangeView
    IconChangerApp -->|"accesses"| SettingsView

    ContentView -->|"triggersIconChange"| Icon_Manager
    ChangeView -->|"triggersIconRestore"| Icon_Manager
    SettingsView -->|"updatesSettings"| Config_Module

    Icon_Manager -->|"cachesUsing"| Icon_Cache
    Icon_Manager -->|"fetchesList"| Icon_List
    Icon_Manager -->|"resolvesResources"| Icon_Resource
    Icon_Manager -->|"usesAuxiliary"| AliasName
    Icon_Manager -->|"displaysImages"| ImageView
    Icon_Manager ---|"monitoredBy"| BackgroundService
    BackgroundService ---|"updatesIconState"| Icon_Manager

    CLI_Tool -->|"issuesCommands"| Icon_Manager
    CLI_Tool -->|"configCommands"| Config_CLI
    CLI_Manager -->|"executesLogic"| Icon_Manager

    Config_Module -->|"suppliesSettings"| Icon_Manager
    Config_Module -->|"syncsWith"| Config_CLI

    External -->|"providesAPIKey"| Config_Module

    %% Styles
    classDef gui fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef cli fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef biz fill:#A9DFBF,stroke:#145A32,stroke-width:2px;
    classDef config fill:#E8DAEF,stroke:#6C3483,stroke-width:2px;
    classDef bg fill:#F5CBA7,stroke:#943126,stroke-width:2px;
    classDef ext fill:#D5F5E3,stroke:#1E8449,stroke-width:2px;

    %% Click Events for Components
    click AppDelegate "https://github.com/bengerthelorf/maciconchanger/blob/main/IconChanger/AppDelegate.swift"
    click IconChangerApp "https://github.com/bengerthelorf/maciconchanger/blob/main/IconChanger/IconChangerApp.swift"
    click ContentView "https://github.com/bengerthelorf/maciconchanger/blob/main/IconChanger/ContentView.swift"
    click ChangeView "https://github.com/bengerthelorf/maciconchanger/blob/main/IconChanger/ChangeView.swift"
    click SettingsView "https://github.com/bengerthelorf/maciconchanger/tree/main/IconChanger/SettingsView"
    click CLI_Tool "https://github.com/bengerthelorf/maciconchanger/blob/main/IconChangerCLI/IconChangerCLI.swift"
    click CLI_Manager "https://github.com/bengerthelorf/maciconchanger/blob/main/IconChanger/CLI/CLIManager.swift"
    click Icon_Manager "https://github.com/bengerthelorf/maciconchanger/blob/main/IconChanger/IconManager.swift"
    click Icon_Cache "https://github.com/bengerthelorf/maciconchanger/blob/main/IconChanger/IconCache.swift"
    click Icon_List "https://github.com/bengerthelorf/maciconchanger/blob/main/IconChanger/IconList.swift"
    click Icon_Resource "https://github.com/bengerthelorf/maciconchanger/blob/main/IconChanger/IconRes.swift"
    click AliasName "https://github.com/bengerthelorf/maciconchanger/tree/main/IconChanger/AliasName"
    click ImageView "https://github.com/bengerthelorf/maciconchanger/tree/main/IconChanger/ImageView"
    click Config_Module "https://github.com/bengerthelorf/maciconchanger/tree/main/IconChanger/Config"
    click Config_CLI "https://github.com/bengerthelorf/maciconchanger/blob/main/IconChanger/ConfigManager+CLI.swift"
    click BackgroundService "https://github.com/bengerthelorf/maciconchanger/blob/main/IconChanger/BackgroundService.swift"
    click AutoUpdater "https://github.com/bengerthelorf/maciconchanger/blob/main/IconChanger/AutoUpdater.swift"
```
