# matiasvillaverde/mobile-ios-vipergame architecture

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

- Interactive diagram: https://gitdiagram.com/matiasvillaverde/mobile-ios-vipergame
- Repository: https://github.com/matiasvillaverde/mobile-ios-vipergame

## Overview

##### Main Components

A. VIPER Module Structure (Core Game Module):
- View Layer (UI Components)
- Interactor (Business Logic)
- Presenter (Presentation Logic)
- Entity (Data Models)
- Router/WireFrame (Navigation)

B. Data Management:
- Local Data Manager
- Content Management (content.json)

C. Supporting Components:
- Utilities
- Resources
- Localization

- Hexagon for View (GameViewController, GameView, CardCell)
- Rectangle for Presenter (GamePresenter)
- Circle for Interactor (GameInteractor)
- Diamond for Entity (Card, Content, Logo)
- Rounded Rectangle for Router (GameWireFrame)

- Blue: View layer components
- Green: Business logic (Interactor)
- Yellow: Presentation logic (Presenter)
- Purple: Data models (Entities)
- Orange: Navigation (Router)
- Gray: Supporting utilities and services

##### Component Relationships

**a. User Interface Flow:**
- View ←→ Presenter ←→ Interactor

**b. Data Flow:**
- Interactor ←→ Local Data Manager
- Interactor ←→ Entities

**c. Navigation Flow:**
- View ←→ Router

##### Specific Implementation Details

Key elements:
**a. Game Module Structure:**
- Application Logic/
- DataManager/
- Entity/
- Interactor/

**b. User Interface/**
- View/
- Presenter/
- WireFrame/

**c. Supporting Systems:**
- Utilities (ArrayRandom, ErrorAlert, File, etc.)
- Localization (en.lproj, de.lproj)
- Assets (card images)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "VIPER Architecture"
        subgraph "View Layer"
            V1[GameView]:::view
            V2[GameViewController]:::view
            V3[CardCell]:::view
        end

        subgraph "Presentation Layer"
            P1[GamePresenter]:::presenter
        end

        subgraph "Business Logic"
            I1[GameInteractor]:::interactor
        end

        subgraph "Data Layer"
            E1[Card]:::entity
            E2[Content]:::entity
            E3[Logo]:::entity
            DM[GameLocalDataManager]:::dataManager
        end

        subgraph "Navigation"
            R1[GameWireFrame]:::router
        end

        subgraph "Supporting Systems"
            direction TB
            U1[ArrayRandom]:::utility
            U2[ErrorAlert]:::utility
            U3[File]:::utility
            U4[UIImage]:::utility
            U5[UIStoryboard]:::utility
            U6[Vibrator]:::utility
        end

        subgraph "Resources"
            direction TB
            CM["content.json"]:::resource
            L1["Localization"]:::resource
            A1["Assets"]:::resource
        end

        subgraph "Test Coverage"
            direction TB
            T1[View Tests]:::test
            T2[Presenter Tests]:::test
            T3[Interactor Tests]:::test
            T4[WireFrame Tests]:::test
        end
    end

    %% Relationships
    V1 & V2 & V3 <--> P1
    P1 <--> I1
    I1 <--> DM
    I1 <--> E1 & E2 & E3
    V1 & V2 <--> R1
    DM <--> CM

    %% Click Events
    click V1 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Modules/Game/User Interface/View/GameView.swift"
    click V2 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Modules/Game/User Interface/View/GameViewController.storyboard"
    click V3 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Modules/Game/User Interface/View/CardCell.swift"
    click P1 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Modules/Game/User Interface/Presenter/GamePresenter.swift"
    click I1 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Modules/Game/Application Logic/Interactor/GameInteractor.swift"
    click E1 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Modules/Game/Application Logic/Entity/Card.swift"
    click E2 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Modules/Game/Application Logic/Entity/Content.swift"
    click E3 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Modules/Game/Application Logic/Entity/Logo.swift"
    click R1 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Modules/Game/User Interface/WireFrame/GameWireFrame.swift"
    click DM "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Modules/Game/Application Logic/DataManager/Local/GameLocalDataManager.swift"
    click CM "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Resources/content.json"
    click U1 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Utilities/ArrayRandom.swift"
    click U2 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Utilities/ErrorAlert.swift"
    click U3 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Utilities/File.swift"
    click U4 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Utilities/UIImage.swift"
    click U5 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Utilities/UIStoryboard.swift"
    click U6 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Utilities/Vibrator.swift"
    click L1 "https://github.com/matiasvillaverde/mobile-ios-vipergame/tree/master/Memory/Modules/Game/User Interface/Localized"
    click A1 "https://github.com/matiasvillaverde/mobile-ios-vipergame/blob/master/Memory/Assets.xcassets"
    click T1 "https://github.com/matiasvillaverde/mobile-ios-vipergame/tree/master/MemoryTests/View"
    click T2 "https://github.com/matiasvillaverde/mobile-ios-vipergame/tree/master/MemoryTests/Presenter"
    click T3 "https://github.com/matiasvillaverde/mobile-ios-vipergame/tree/master/MemoryTests/Interactor"
    click T4 "https://github.com/matiasvillaverde/mobile-ios-vipergame/tree/master/MemoryTests/Wireframe"

    %% Styles
    classDef view fill:#4a90e2,stroke:#2171c7,color:white
    classDef presenter fill:#f5a623,stroke:#d4840f,color:white
    classDef interactor fill:#7ed321,stroke:#5fb001,color:white
    classDef entity fill:#9013fe,stroke:#7001cb,color:white
    classDef router fill:#ff9500,stroke:#d67e00,color:white
    classDef dataManager fill:#50e3c2,stroke:#29c59d,color:white
    classDef utility fill:#8b8b8b,stroke:#6b6b6b,color:white
    classDef resource fill:#4a4a4a,stroke:#2a2a2a,color:white
    classDef test fill:#b8e986,stroke:#95c462,color:black
```
