# juliandr14/actitracker-swift architecture

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

- Interactive diagram: https://gitdiagram.com/juliandr14/actitracker-swift
- Repository: https://github.com/juliandr14/actitracker-swift

## Overview

##### Overall Project Type and Purpose
- ActiTracker is a native iOS app developed in Swift that leverages modern iOS frameworks (such as SwiftUI and Core Data). Its main purpose is to register activities, track the time spent on each activity, and generate daily reports. It further integrates with iPhone’s native Activity Life for a connected experience.

##### Analyzing the File Structure
- The project is organized into multiple directories:
- The main app files are under the “ActiTracker” folder, including the entry point (ActiTrackerApp.swift) and configuration files (Info.plist, Launch Screen.storyboard).
- The “Core” folder contains components, data handling, extensions, and model files. This is where the business logic and persistent storage fundamentals (via Core Data in ActivityModel.xcdatamodeld) reside.
- The “Features” directory is subdivided further into modules for different features such as “AddActivity”, “Home”, “Reports”, “Settings”, and “Timer”. Each feature is split into Components, ViewModels, and Views. This separation reflects a clean architectural design (resembling an MVVM or similar pattern).
- There is also a “MyExtension” folder that represents an iOS extension (likely a widget or another related extension) with its own UI, assets, and logic.
- The presence of structured directories like “Components”, “ViewModel”, and “Views” for each feature indicates an emphasis on separation of concerns and modular design.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        ACT_APP["ActiTracker App (ActiTrackerApp.swift)"]:::presentation
    end

    %% Features Modules
    subgraph "Features Modules"
        subgraph "AddActivity Feature"
            AA_Components["Components"]:::feature
            AA_VM["ViewModel (ActivitiesViewModel)"]:::feature
            AA_View["Views (AddActivity)"]:::feature
        end
        subgraph "Home Feature"
            Home_View["HomeView"]:::feature
        end
        subgraph "Reports Feature"
            Reports_Components["Components"]:::feature
            Reports_VM["ViewModel (ReportsViewModel)"]:::feature
            Reports_View["Views (ReportsView)"]:::feature
        end
        subgraph "Timer Feature"
            Timer_Components["Components"]:::feature
            Timer_VM["ViewModel (ActivityTimerViewModel)"]:::feature
            Timer_View["Views (ActivityTimerView)"]:::feature
        end
        subgraph "Settings Feature"
            Settings_View["SettingsView"]:::feature
        end
    end

    %% Core Layer
    subgraph "Core Layer"
        subgraph "Data Management"
            Core_Persistence["Persistence (Persistence.swift)"]:::core
            Core_ModelDB["Activity Model (ActivityModel.xcdatamodeld)"]:::core
        end
        subgraph "Business Logic"
            Core_Biz_Attributes["ActivitiesAttributes"]:::core
            Core_Biz_UseCase["ActivittiesUseCase"]:::core
        end
        subgraph "Shared UI Components"
            UI_Animated["AnimatedProgressBar"]:::core
            UI_Color["ColorCircleView"]:::core
        end
    end

    %% Extension Module
    subgraph "Extension Module"
        Ext_AppIntent["AppIntent"]:::extension
        Ext_Control["MyExtensionControl"]:::extension
        Ext_LiveActivity["MyExtensionLiveActivity"]:::extension
    end

    %% External Services
    subgraph "External Services"
        Activity_Life["Activity Life Integration"]:::external
    end

    %% Connections from Presentation to Features
    ACT_APP -->|"loads"| AA_View
    ACT_APP -->|"loads"| Home_View
    ACT_APP -->|"loads"| Reports_View
    ACT_APP -->|"loads"| Timer_View
    ACT_APP -->|"loads"| Settings_View

    %% Feature to Core (ViewModel interactions)
    AA_VM -->|"binds_to"| Core_Persistence
    AA_VM -->|"uses"| Core_Biz_UseCase

    Reports_VM -->|"binds_to"| Core_Persistence
    Reports_VM -->|"uses"| Core_Biz_UseCase

    Timer_VM -->|"binds_to"| Core_Persistence
    Timer_VM -->|"uses"| Core_Biz_UseCase

    Home_View -->|"reads_from"| Core_Persistence

    %% Shared UI Components used by Feature Views
    AA_View ---|"uses"| UI_Animated
    AA_View ---|"uses"| UI_Color
    Reports_View ---|"uses"| UI_Animated
    Reports_View ---|"uses"| UI_Color
    Timer_View ---|"uses"| UI_Animated
    Timer_View ---|"uses"| UI_Color
    Home_View ---|"uses"| UI_Animated
    Home_View ---|"uses"| UI_Color
    Settings_View ---|"uses"| UI_Animated
    Settings_View ---|"uses"| UI_Color

    %% Internal Feature interactions
    AA_Components --> AA_VM
    Reports_Components --> Reports_VM
    Timer_Components --> Timer_VM

    AA_View -->|"triggers"| AA_VM
    Reports_View -->|"triggers"| Reports_VM
    Timer_View -->|"triggers"| Timer_VM
    Home_View -->|"observes"| Core_Biz_Attributes

    %% Extension interactions
    Ext_AppIntent -->|"communicates_with"| ACT_APP
    Ext_Control -->|"communicates_with"| ACT_APP
    Ext_LiveActivity -->|"forwards_to"| Activity_Life

    %% External Service integration
    ACT_APP -->|"integrates_with"| Activity_Life

    %% Click Events
    click ACT_APP "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/ActiTrackerApp.swift"
    click Core_Persistence "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/Core/Data/Persistence.swift"
    click Core_ModelDB "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/ActivityModel.xcdatamodeld"
    click Core_Biz_Attributes "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/Core/Models/ActivitiesAttributes.swift"
    click Core_Biz_UseCase "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/Core/Models/ActivittiesUseCase.swift"
    click UI_Animated "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/Core/Components/AnimatedProgressBar.swift"
    click UI_Color "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/Core/Components/ColorCircleView.swift"
    click AA_Components "https://github.com/juliandr14/actitracker-swift/tree/main/ActiTracker/Features/AddActivity/Components"
    click AA_VM "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/Features/AddActivity/ViewModel/ActivitiesViewModel.swift"
    click AA_View "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/Features/AddActivity/Views/AddActivity.swift"
    click Home_View "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/Features/Home/HomeView.swift"
    click Reports_VM "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/Features/Reports/ViewModel/ReportsViewModel.swift"
    click Reports_View "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/Features/Reports/Views/ReportsView.swift"
    click Timer_VM "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/Features/Timer/ViewModel/ActivityTimerViewModel.swift"
    click Timer_View "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/Features/Timer/Views/ActivityTimerView.swift"
    click Settings_View "https://github.com/juliandr14/actitracker-swift/blob/main/ActiTracker/Features/Settings/Views/SettingsView.swift"
    click Ext_AppIntent "https://github.com/juliandr14/actitracker-swift/blob/main/MyExtension/AppIntent.swift"
    click Ext_Control "https://github.com/juliandr14/actitracker-swift/blob/main/MyExtension/MyExtensionControl.swift"
    click Ext_LiveActivity "https://github.com/juliandr14/actitracker-swift/blob/main/MyExtension/MyExtensionLiveActivity.swift"

    %% Styles
    classDef presentation fill:#ffcc00,stroke:#000,stroke-width:2px;
    classDef feature fill:#9fd,stroke:#333,stroke-width:2px;
    classDef core fill:#ccf,stroke:#000,stroke-width:2px;
    classDef extension fill:#f99,stroke:#000,stroke-width:2px;
    classDef external fill:#cfc,stroke:#000,stroke-width:2px;
```
