# developeracademy-postech/2024-mc2-a9-fup architecture

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

- Interactive diagram: https://gitdiagram.com/developeracademy-postech/2024-mc2-a9-fup
- Repository: https://github.com/developeracademy-postech/2024-mc2-a9-fup

## Overview

##### Project Type & Purpose
- This is an iOS mobile application built primarily with Swift/SwiftUI. It consists of a main app (found under the “F-UP” directory) and a widget extension (under “ExpressionStreakWidget”) that likely offers a quick-access “streak” feature.
- The README hints at an app with multiple features while highlighting the tech stack (Swift, SwiftUI), and the visuals (screenshots and demo placeholders) further suggest a consumer-facing mobile application.

##### Analyzing the File Structure
- There are two key program areas:
- The main app (“F-UP”) which is carved into submodules: App, Components, Extensions, Manager, Models, ViewModels, and Views. This strongly suggests an MVVM architecture, with Managers handling business logic (like audio, haptics, notifications, SwiftData) and ViewModels linking the Models with the Views.
- The widget (“ExpressionStreakWidget”) has its own Swift files, asset catalogs, and an Info.plist, indicating it is built as a separate extension that integrates with the main app.
- The presence of .xcodeproj, .xcworkspace files, and entitlements confirms standard iOS project structure with configurations for both app and widget.

##### Architectural Components & Relationships
- Main App (F-UP):
- App: Entry point (F_UPApp.swift) and launch storyboard.
- Views: Organized into different feature areas like Challenge, History, Launch, and RecordReview.
- ViewModels: Separated by feature (Challenge, History) to handle UI state and business logic.
- Managers: Centralized components for handling system services (AVFoundation, Haptics, Notifications, Data Management).
- Components & Extensions: Reusable UI components (CustomProgressView, CustomSlider) and utility extensions.
- Models: Contain core data structures and enums used across the app.
- Widget (ExpressionStreakWidget):
- Shared / External Dependencies:
- Although not extensive, the project uses asset packs and potentially system frameworks (AVFoundation, SwiftData, etc.) integrated across modules.

- Main App (F-UP)
- Widget Extension (ExpressionStreakWidget)
- Under the Main App, break it down further:
- UI Layer: Views organized by feature (Challenge, History, Launch, RecordReview) connected to their respective ViewModels.
- Business Logic/Service Layer: Managers (AVFoundationManager, HapticManager, NotificationManager, SwiftDataManager).
- Model Layer: Data models and enums that define the domain.
- Reusable Components & Extensions: UI components and extensions that provide common functionality.
- Directional data flow:
- The Widget should point to the relevant shared data (assets, maybe simplified view models) to display concise information.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Main App (F-UP)"
        direction TB
        subgraph "Entry Point"
            AppEntry["F_UPApp.swift"]:::appEntry
        end
        subgraph "UI Layer (Views)"
            direction TB
            ChallengeViews["Challenge Views"]:::views
            HistoryViews["History Views"]:::views
            LaunchViews["Launch Views"]:::views
            RecordReviewViews["RecordReview Views"]:::views
        end
        subgraph "MVVM Layer (ViewModels)"
            direction TB
            ChallengeVM["Challenge ViewModel"]:::viewModel
            HistoryVM["History ViewModel"]:::viewModel
        end
        subgraph "Business/Service Managers"
            direction TB
            AVManager["AVFoundation Manager"]:::manager
            HapticManager["Haptic Manager"]:::manager
            NotificationManager["Notification Manager"]:::manager
            SwiftDataManager["SwiftData Manager"]:::manager
        end
        subgraph "Data Models"
            Models["Models & Enums"]:::models
        end
        subgraph "Reusable Components"
            Components["Components"]:::components
        end
        subgraph "Extensions"
            Extensions["Extensions"]:::extensions
        end
        subgraph "Resources"
            Assets["App Assets"]:::resources
        end
    end

    subgraph "Widget Module"
        WidgetSource["Widget Source & Assets"]:::widget
    end

    %% Arrows for Main App Flow
    AppEntry -->|"launches"| ChallengeViews
    AppEntry -->|"launches"| HistoryViews
    AppEntry -->|"launches"| LaunchViews
    AppEntry -->|"launches"| RecordReviewViews

    ChallengeViews -->|"binds"| ChallengeVM
    HistoryViews -->|"binds"| HistoryVM

    Models -->|"feeds"| ChallengeVM
    Models -->|"feeds"| HistoryVM

    ChallengeVM -->|"invokes"| AVManager
    ChallengeVM -->|"invokes"| HapticManager
    ChallengeVM -->|"invokes"| NotificationManager
    ChallengeVM -->|"invokes"| SwiftDataManager

    HistoryVM -->|"invokes"| NotificationManager
    HistoryVM -->|"invokes"| SwiftDataManager

    ChallengeViews -->|"uses"| Components
    HistoryViews -->|"uses"| Components
    LaunchViews -->|"uses"| Components
    RecordReviewViews -->|"uses"| Components

    ChallengeViews -->|"uses"| Extensions
    HistoryViews -->|"uses"| Extensions
    LaunchViews -->|"uses"| Extensions
    RecordReviewViews -->|"uses"| Extensions

    Assets -->|"shared_by"| WidgetSource

    %% Click Events
    click AppEntry "https://github.com/developeracademy-postech/2024-mc2-a9-fup/blob/develop/F-UP/App/F_UPApp.swift"
    click ChallengeViews "https://github.com/developeracademy-postech/2024-mc2-a9-fup/tree/develop/F-UP/Views/Challenge"
    click HistoryViews "https://github.com/developeracademy-postech/2024-mc2-a9-fup/tree/develop/F-UP/Views/History"
    click LaunchViews "https://github.com/developeracademy-postech/2024-mc2-a9-fup/tree/develop/F-UP/Views/Launch"
    click RecordReviewViews "https://github.com/developeracademy-postech/2024-mc2-a9-fup/tree/develop/F-UP/Views/RecordReview"
    click ChallengeVM "https://github.com/developeracademy-postech/2024-mc2-a9-fup/blob/develop/F-UP/ViewModels/Challenge/ChallengeViewModel.swift"
    click HistoryVM "https://github.com/developeracademy-postech/2024-mc2-a9-fup/blob/develop/F-UP/ViewModels/History/HistoryViewModel.swift"
    click AVManager "https://github.com/developeracademy-postech/2024-mc2-a9-fup/blob/develop/F-UP/Manager/AVFoundationManager.swift"
    click HapticManager "https://github.com/developeracademy-postech/2024-mc2-a9-fup/blob/develop/F-UP/Manager/HapticManager.swift"
    click NotificationManager "https://github.com/developeracademy-postech/2024-mc2-a9-fup/blob/develop/F-UP/Manager/NotificationManger.swift"
    click SwiftDataManager "https://github.com/developeracademy-postech/2024-mc2-a9-fup/blob/develop/F-UP/Manager/SwiftDataManager.swift"
    click Models "https://github.com/developeracademy-postech/2024-mc2-a9-fup/tree/develop/F-UP/Models"
    click Components "https://github.com/developeracademy-postech/2024-mc2-a9-fup/tree/develop/F-UP/Components"
    click Extensions "https://github.com/developeracademy-postech/2024-mc2-a9-fup/tree/develop/F-UP/Extensions"
    click Assets "https://github.com/developeracademy-postech/2024-mc2-a9-fup/blob/develop/F-UP/Resources/Assets.xcassets"
    click WidgetSource "https://github.com/developeracademy-postech/2024-mc2-a9-fup/tree/develop/ExpressionStreakWidget"

    %% Styles
    classDef appEntry fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef views fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef viewModel fill:#ccccff,stroke:#333,stroke-width:2px;
    classDef manager fill:#ffffcc,stroke:#333,stroke-width:2px;
    classDef models fill:#ffccff,stroke:#333,stroke-width:2px;
    classDef components fill:#d1e0e0,stroke:#333,stroke-width:2px;
    classDef extensions fill:#e0d1e0,stroke:#333,stroke-width:2px;
    classDef resources fill:#ffe6cc,stroke:#333,stroke-width:2px;
    classDef widget fill:#cce6ff,stroke:#333,stroke-width:2px;
```
