# sugurutakahashi-1234/framework-independent-architecture architecture

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

- Interactive diagram: https://gitdiagram.com/sugurutakahashi-1234/framework-independent-architecture
- Repository: https://github.com/sugurutakahashi-1234/framework-independent-architecture

## Overview

##### Project type and purpose
- This is an iOS sample app (SwiftUI) demonstrating a Framework-Independent Architecture (FIA)—a Clean-Architecture-inspired, multi-module, multi-project setup using Swift Package Manager (SPM) and Xcode workspaces.
- Purpose: Show how to split the code into Presentation, Domain, Framework, and Dependency-Injection layers, with separate Xcode projects for development (using mocks) and production (using real drivers) to speed up build times.

##### File structure
- Top-level:
- FIASample.xcworkspace
- Two Xcode projects under FIASample/Development and FIASample/Production (each containing its own App target, asset catalogs, tests).
- FIASamplePackage (an SPM package) with four modules under Sources:
– DependencyInjectionLayer
– PresentationLayer
– DomainLayer
– FrameworkLayer
- Tests under FIASamplePackage/Tests for unit testing.
- Configuration files: Package.swift (defines inter-module dependencies), Xcode project files, .gitignore.

##### Additional insights from README
- There are two entry points: DevelopmentApp (injects MockDIContainer) and ProductionApp (injects DIContainer with real FrameworkLayer.LicenseDriver).
- Dependency graph (from README):
- DependencyInjectionLayer → {FrameworkLayer, PresentationLayer}
- PresentationLayer → DomainLayer
- FrameworkLayer → DomainLayer & LicensesPlugin
- Clean Area extends from Presentation through Application Layer; FrameworkLayer is Non-Clean Area.

##### Elements
- Clear labels: “DomainLayer,” “PresentationLayer,” “DependencyInjectionLayer,” “FrameworkLayer,” “DevelopmentApp,” “ProductionApp,” “LicensesPlugin.”
- PresentationLayer → DomainLayer
- FrameworkLayer → DomainLayer
- DependencyInjectionLayer → {PresentationLayer, FrameworkLayer}
- App → DependencyInjectionLayer
- FrameworkLayer → LicensesPlugin
- Another for “DI/Application” (DependencyInjectionLayer, App targets)
- A third for “Non-Clean Area” (FrameworkLayer, external plugin)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Layers
    subgraph "Clean Area"
        direction TB
        subgraph "PresentationLayer"
            direction TB
            ContentView["ContentView"]:::clean
            LicenseListView["LicenseListView"]:::clean
            LicenseListPresenter["LicenseListPresenter"]:::clean
            DIContainerDependency["DIContainerDependency"]:::clean
            LicenseListPresenterDependency["LicenseListPresenterDependency"]:::clean
            MockLicenseDriver["MockLicenseDriver"]:::clean
            MockLogDriver["MockLogDriver"]:::clean
        end
        subgraph "DomainLayer"
            direction TB
            License["License"]:::clean
            LicenseDriverProtocol["LicenseDriverProtocol"]:::clean
            LogDriverProtocol["LogDriverProtocol"]:::clean
            BuildScheme["BuildScheme"]:::clean
        end
    end

    subgraph "DI/Application Layer"
        direction TB
        DevelopmentApp["DevelopmentApp"]:::app
        ProductionApp["ProductionApp"]:::app
        DIContainer["DIContainer"]:::app
        MockDIContainer["MockDIContainer"]:::app
    end

    subgraph "Non-Clean Area"
        direction TB
        FrameworkLayer["FrameworkLayer"]:::nonclean
        LicenseDriverReal["LicenseDriver (Real)"]:::nonclean
        LogDriverReal["LogDriver (Real)"]:::nonclean
        LicensesPlugin["LicensesPlugin"]:::external
    end

    %% Dependencies
    LicenseListPresenter -->|"uses"| LicenseDriverProtocol
    LicenseListPresenter -->|"uses"| LogDriverProtocol
    LicenseListView -->|"binds to"| LicenseListPresenter
    ContentView -->|"hosts"| LicenseListView

    LicenseDriverReal -->|"implements"| LicenseDriverProtocol
    LogDriverReal -->|"implements"| LogDriverProtocol
    FrameworkLayer -->|"provides drivers"| LicenseDriverReal
    FrameworkLayer -->|"provides drivers"| LogDriverReal
    FrameworkLayer -->|"calls"| LicensesPlugin

    DIContainer -->|"injects"| LicenseDriverReal
    DIContainer -->|"injects"| LogDriverReal
    MockDIContainer -->|"injects mocks"| MockLicenseDriver
    MockDIContainer -->|"injects mocks"| MockLogDriver

    DevelopmentApp -->|"uses"| MockDIContainer
    ProductionApp -->|"uses"| DIContainer

    DIContainerDependency -->|"dependency"| DIContainer
    LicenseListPresenterDependency -->|"dependency"| LicenseListPresenter

    %% Arrow across layers
    PresentationLayer -->|"depends on"| DomainLayer
    FrameworkLayer -->|"depends on"| DomainLayer
    DIContainer -->|"depends on"| FrameworkLayer
    DIContainer -->|"depends on"| PresentationLayer

    %% Click Events
    click DevelopmentApp "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/Development/Development/DevelopmentApp.swift"
    click ProductionApp "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/Production/Production/ProductionApp.swift"
    click DIContainer "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/DependencyInjectionLayer/DIContainer.swift"
    click MockDIContainer "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/PresentationLayer/MockDIContainer.swift"
    click ContentView "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/PresentationLayer/ContentView.swift"
    click LicenseListView "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/PresentationLayer/LicenseListView.swift"
    click LicenseListPresenter "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/PresentationLayer/LicenseListPresenter.swift"
    click DIContainerDependency "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/PresentationLayer/DIContainerDependency.swift"
    click LicenseListPresenterDependency "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/PresentationLayer/LicenseListPresenterDependency.swift"
    click MockLicenseDriver "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/PresentationLayer/MockLicenseDriver.swift"
    click MockLogDriver "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/PresentationLayer/MockLogDriver.swift"
    click License "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/DomainLayer/License.swift"
    click LicenseDriverProtocol "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/DomainLayer/LicenseDriverProtocol.swift"
    click LogDriverProtocol "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/DomainLayer/LogDriverProtocol.swift"
    click BuildScheme "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/DomainLayer/BuildScheme.swift"
    click LicenseDriverReal "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/FrameworkLayer/LicenseDriver.swift"
    click LogDriverReal "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Sources/FrameworkLayer/LogDriver.swift"
    click LicensesPlugin "https://github.com/sugurutakahashi-1234/framework-independent-architecture/blob/main/FIASample/FIASamplePackage/Package.swift"

    %% Styles
    classDef clean fill:#E0F7FA,stroke:#006064,color:#004D40
    classDef app fill:#FFF9C4,stroke:#F57F17,color:#E65100
    classDef nonclean fill:#FFEBEE,stroke:#B71C1C,color:#880E4F
    classDef external fill:#E8EAF6,stroke:#3F51B5,color:#1A237E
```
