# kudoleh/ios-clean-architecture-mvvm architecture

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

- Interactive diagram: https://gitdiagram.com/kudoleh/ios-clean-architecture-mvvm
- Repository: https://github.com/kudoleh/ios-clean-architecture-mvvm

## Overview

##### Main Components Identification

a) Domain Layer (Core Business Logic)
- Entities (Movie, MovieQuery)
- Use Cases (SearchMoviesUseCase, FetchRecentMovieQueriesUseCase)
- Repository Interfaces

b) Data Layer
- Repository Implementations
- Network Services
- Persistent Storage (CoreData, UserDefaults)
- Data Transfer Objects (DTOs)

c) Presentation Layer
- MVVM Components (ViewModels, Views)
- Flow Coordinators
- UI Components

**┌─────────────────────────────────────────────┐**
- Presentation Layer                          │
- ┌─────────────┐ ┌──────────┐ ┌──────────┐  │
- Views    │ │ViewModels│ │  Flows   │  │
- ┘ └──────────┘ └──────────┘  │
- ┘
- ▲
- (Depends on)
**┌─────────────────────────────────────────────┐**
- Domain Layer                                │
- ┌─────────────┐ ┌──────────┐ ┌──────────┐  │
- Entities   │ │Use Cases │ │Repository │  │
- ┘ └──────────┘ │Interfaces │  │
- ┘  │
- ┘
- ▲
- (Depends on)
**┌─────────────────────────────────────────────┐**
- Data Layer                                  │
- ┌─────────────┐ ┌──────────┐ ┌──────────┐  │
- Repository  │ │ Network  │ │Persistent│  │
- Impl     │ │ Service  │ │ Storage  │  │
- ┘ └──────────┘ └──────────┘  │
- ┘

##### Detailed Component Relationships

- Data flow between components
- Dependency injection paths
- Repository pattern implementation
- MVVM binding relationships
- Flow coordinator navigation paths

##### Special Features to Highlight

- DIContainer structure
- Flow Coordinator pattern
- Data binding mechanism using Observable
- Caching mechanism
- Error handling flow

##### Implementation Details

Technical annotations for:
- SwiftUI/UIKit view implementations
- CoreData storage
- Network layer implementation
- DTO mapping
- Unit test coverage

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef presentation fill:#e1f5fe,stroke:#01579b
    classDef domain fill:#e8f5e9,stroke:#1b5e20
    classDef data fill:#fff3e0,stroke:#e65100
    classDef storage fill:#f3e5f5,stroke:#4a148c
    classDef external fill:#fafafa,stroke:#424242

    %% Legend
    subgraph Legend
        L1[Presentation Layer]:::presentation
        L2[Domain Layer]:::domain
        L3[Data Layer]:::data
        L4[(Storage)]:::storage
        L5[("External Services")]:::external
    end

    %% Presentation Layer
    subgraph PresentationLayer
        UI["UI Components"]:::presentation
        Views["Views"]:::presentation
        ViewModels["ViewModels"]:::presentation
        FlowCoords["Flow Coordinators"]:::presentation
        AppFlowCoord["Application Flow Coordinator"]:::presentation
        DIContainer["Dependency Injection Container"]:::presentation
    end

    %% Domain Layer
    subgraph DomainLayer
        Entities["Domain Entities"]:::domain
        UseCases["Use Cases"]:::domain
        RepoInterfaces["Repository Interfaces"]:::domain
    end

    %% Data Layer
    subgraph DataLayer
        RepoImpl["Repository Implementations"]:::data
        NetworkServices["Network Services"]:::data
        DataMapping["Data Transfer Objects"]:::data
        CoreData[(CoreData Storage)]:::storage
        UserDefaults[(UserDefaults Storage)]:::storage
        APIService[("External API")]:::external
    end

    %% Relationships
    PresentationLayer --> DomainLayer
    DomainLayer --> DataLayer
    NetworkServices --> APIService
    RepoImpl --> CoreData
    RepoImpl --> UserDefaults
    NetworkServices --> DataMapping

    %% Component mappings with click events
    click Entities "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/tree/master/ExampleMVVM/Domain/Entities/"
    click UseCases "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/tree/master/ExampleMVVM/Domain/UseCases/"
    click RepoInterfaces "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/tree/master/ExampleMVVM/Domain/Interfaces/Repositories/"
    click RepoImpl "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/tree/master/ExampleMVVM/Data/Repositories/"
    click NetworkServices "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/tree/master/ExampleMVVM/Infrastructure/Network/"
    click CoreData "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/tree/master/ExampleMVVM/Data/PersistentStorages/CoreDataStorage/"
    click UserDefaults "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/tree/master/ExampleMVVM/Data/PersistentStorages/MoviesQueriesStorage/UserDefaultsStorage/"
    click DataMapping "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/tree/master/ExampleMVVM/Data/Network/DataMapping/"
    click ViewModels "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/tree/master/ExampleMVVM/Presentation/MoviesScene/MoviesList/ViewModel/"
    click Views "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/tree/master/ExampleMVVM/Presentation/MoviesScene/MoviesList/View/"
    click FlowCoords "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/tree/master/ExampleMVVM/Presentation/MoviesScene/Flows/"
    click DIContainer "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/tree/master/ExampleMVVM/Application/DIContainer/"
    click AppFlowCoord "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/blob/master/ExampleMVVM/Application/AppFlowCoordinator.swift"
    click UI "https://github.com/kudoleh/iOS-Clean-Architecture-MVVM/tree/master/ExampleMVVM/Presentation/MoviesScene/MoviesList/View/MoviesListTableView/Cells/"
```
