# developeracademy-postech/2024-mc3-a05-phototodo architecture

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

- Interactive diagram: https://gitdiagram.com/developeracademy-postech/2024-mc3-a05-phototodo
- Repository: https://github.com/developeracademy-postech/2024-mc3-a05-phototodo

## Overview

##### Main Components
- App Core (PhotoTodo):
– Contains the main application entry point (PhotoTodoApp.swift) and central logic.
– Views: Multiple SwiftUI view files (e.g., MainView.swift, DashBoardView.swift, FolderListView.swift, TodoItemView.swift, etc.) that build the UI.
– View Models: Organized within the “ViewModel” directory (CameraManager.swift, CameraViewModel.swift, FolderManager.swift) to follow the MVVM pattern.
– Models: Data structures and domain objects defined in the “Models” folder (e.g., PhotoTodoModel.swift).
– Utilities and Extensions: Files such as Date+Extension.swift for common helper methods.

- Assets & Resources:

- Share Extension (ShareImage):
– A separate target/extension that includes its own storyboard (MainInterface.storyboard) and swift file (ShareViewController.swift) to handle sharing functionality.

- Project Configuration:
– The Xcode project files (PhotoTodo.xcodeproj and its associated workspace and configuration files) provide the build and deployment configuration.

##### Relationships & Interactions
- UI Layer ↔ ViewModel Layer:
– SwiftUI views interact with corresponding view models to manage state, capture images (via the CameraManager), and perform business logic to create todos.
- ViewModel Layer ↔ Model/Service Layer:
– The view models manipulate model objects (like PhotoTodoModel) and manage business processes (e.g., temporary storage and auto-deletion logic).
- Assets & Configuration:
– The assets are used by the UI for consistent branding and appearance. Info.plist and entitlements files configure permissions (e.g., for camera and notifications).
- Share Extension:
– Works independently but may share data or link back to the main app's functionality (e.g., shared storage or todo creation).

##### Architectural Patterns & Design Principles
- MVVM Pattern:
– The separation between views, view models, and models clarifies responsibilities and helps manage data flow in SwiftUI applications.
- Separation of Concerns:
– User interface components are separate from business logic and data handling.
- Modular Extension:
– The share extension is a distinct module that integrates with the main app but may have its own lifecycle and view structure.

##### Relevant Technologies & Frameworks
- Swift and SwiftUI: Core language and UI framework.
- Xcode Project Infrastructure: Including .xcodeproj, .xcworkspace files.
- Local data management: Temporary persistence and auto-delete functionality to minimize resource use and contribute to reduced digital carbon footprint.

## Diagram (Mermaid)

```mermaid
graph TB
    %% App Core (UI Layer)
    subgraph "App Core (UI Layer)"
        PhotoTodoApp("PhotoTodoApp (Entry)"):::ui
        MainView("MainView"):::ui
        DashBoardView("DashBoardView"):::ui
        FolderListView("FolderListView"):::ui
        TodoItemView("TodoItemView"):::ui
        CameraView("CameraView"):::ui
        TabBarView("TabBarView"):::ui
    end

    %% ViewModel Layer
    subgraph "ViewModel Layer"
        CameraManager("CameraManager"):::vm
        CameraViewModel("CameraViewModel"):::vm
        FolderManager("FolderManager"):::vm
    end

    %% Model Layer
    subgraph "Model Layer"
        PhotoTodoModel("PhotoTodoModel"):::model
    end

    %% Temporary Photo Storage Annotation
    subgraph "Temporary Photo Storage"
        TempStorage("Temp Storage (Auto-Deletion after 30 days)"):::model
    end

    %% Utilities & Extensions
    subgraph "Utilities & Extensions"
        DateExtension("Date+Extension"):::util
        ColorHelper("Color"):::util
    end

    %% Assets & Resources
    subgraph "Assets & Resources"
        Assets("Assets.xcassets"):::assets
        Config("Info.plist & Entitlements"):::assets
    end

    %% Share Extension
    subgraph "Share Extension"
        ShareViewController("ShareViewController"):::ext
        MainInterface("MainInterface (Storyboard)"):::ext
    end

    %% Project Configuration
    subgraph "Project Configuration"
        XcodeProject("Xcode Project"):::proj
    end

    %% Connections
    XcodeProject -->|"configures"| PhotoTodoApp
    Assets -->|"provides assets"| PhotoTodoApp
    Config -->|"configures"| PhotoTodoApp

    MainView -->|"bindsTo"| CameraViewModel
    CameraView -->|"invokes"| CameraManager
    DashBoardView -->|"interactsWith"| FolderManager
    FolderListView -->|"interactsWith"| FolderManager

    CameraViewModel -->|"updates"| PhotoTodoModel
    FolderManager -->|"updates"| PhotoTodoModel

    CameraView -->|"capturesPhoto"| TempStorage
    TempStorage -->|"convertsToTodo"| PhotoTodoModel

    MainInterface --> ShareViewController
    ShareViewController -->|"createsTodo"| PhotoTodoModel
    ShareViewController -->|"integratesWith"| PhotoTodoApp

    %% Styles
    classDef ui fill:#cce5ff,stroke:#0a3d62,stroke-width:2px;
    classDef vm fill:#d5f5e3,stroke:#145a32,stroke-width:2px;
    classDef model fill:#f9e79f,stroke:#7d6608,stroke-width:2px;
    classDef util fill:#f5b7b1,stroke:#922b21,stroke-width:2px;
    classDef assets fill:#d6eaf8,stroke:#2471a3,stroke-width:2px;
    classDef ext fill:#fad7a0,stroke:#c0392b,stroke-width:2px;
    classDef proj fill:#e8daef,stroke:#6c3483,stroke-width:2px;

    %% Click Events
    click PhotoTodoApp "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo/PhotoTodoApp.swift"
    click MainView "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo/MainView.swift"
    click DashBoardView "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo/DashBoardView.swift"
    click FolderListView "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo/FolderListView.swift"
    click TodoItemView "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo/TodoItemView.swift"
    click CameraManager "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo/ViewModel/CameraManager.swift"
    click CameraViewModel "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo/ViewModel/CameraViewModel.swift"
    click FolderManager "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo/ViewModel/FolderManager.swift"
    click PhotoTodoModel "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo/Models/PhotoTodoModel.swift"
    click DateExtension "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo/Date+Extension.swift"
    click ColorHelper "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo/Color.swift"
    click Assets "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo/Assets.xcassets"
    click Config "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo/Info.plist"
    click ShareViewController "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/ShareImage/ShareViewController.swift"
    click MainInterface "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/ShareImage/Base.lproj/MainInterface.storyboard"
    click XcodeProject "https://github.com/developeracademy-postech/2024-mc3-a05-phototodo/blob/dev/PhotoTodo.xcodeproj"
```
