# ddd-community/ddd11-sclass-ios architecture

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

- Interactive diagram: https://gitdiagram.com/ddd-community/ddd11-sclass-ios
- Repository: https://github.com/ddd-community/ddd11-sclass-ios

## Overview

##### Project type and purpose
- This is a modularized iOS application built with Swift, organized according to Domain-Driven Design (DDD) principles.
- It uses Tuist to generate and configure projects, with custom Tuist plugins under the Plugins directory.
- There are three primary layer groupings:
– Projects/App: the main iOS application target (SwiftUI based entry point, AppDelegate, RootView/Store)
– Projects/Core: low-level modules (Common utilities, Domain models, Network infrastructure and API clients)
– Projects/Feature: feature-specific Swift packages (Article, Chat, Home, History, Login, MyPage, Onboarding, Splash)
– Projects/Shared: cross-cutting UI assets (DesignSystem), third-party libs, and utilities

##### File structure and architectural patterns
- The presence of Tuist/Config.swift, Project.swift, WorkSpace.swift, Plugins indicates an Infrastructure-as-Code approach for project generation.
- Core is split into three modules:
– Common (UI skeleton components, shared extensions)
– Domain (pure business models)
– Network (APIService, BaseAPI, individual Service + APIClient pairs for Article, Chat, Checklist, Home, Login, MyPage, Onboarding, Keychain)
- Feature packages each expose a SwiftUI View → Store (state + actions) → inject domain models + network clients
- The overall pattern: MVVM/Redux-style Stores for state management, DDD layering, Swift Package Manager modularization

##### README for additional insights
- README confirms DDD and SClass-iOS onboarding kit purpose

– Blue for UI/SwiftUI components
– Green for Business Logic/Domain
– Orange for Networking/API
– Grey for Shared utilities/design system
– Purple for Tuist and build infrastructure
- Number the main data-flow steps to emphasize unidirectional flow.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Tuist Infrastructure
    subgraph "Tuist Infrastructure"
        direction TB
        TI_Plugins["Plugins"]:::infra
        TI_Config["Tuist/Config.swift"]:::infra
        TI_Workspace["WorkSpace.swift"]:::infra
    end

    %% App Layer
    subgraph "App Layer" 
        direction TB
        App_Project["Projects/App/Project.swift"]:::ui
        App_Delegate["AppDelegate.swift"]:::ui
        App_RootApp["RootApp.swift"]:::ui
        App_RootStore["RootStore.swift"]:::ui
        App_RootView["RootView.swift"]:::ui
        App_Resources["Resources"]:::ui
    end

    %% Core Modules
    subgraph "Core Modules"
        direction TB
        Core_Common["Common Module"]:::domain
        Core_Common_Proj["Project.swift"]:::domain
        Core_Domain["Domain Module"]:::domain
        Core_Domain_Proj["Project.swift"]:::domain
        Core_Network["Network Module"]:::network
        Core_Network_Proj["Project.swift"]:::network
    end

    %% Shared Modules
    subgraph "Shared Modules"
        direction TB
        Shared_DesignSystem["DesignSystem"]:::shared
        Shared_ThirdParty["ThirdPartyLib"]:::shared
        Shared_Utils["Utils"]:::shared
    end

    %% Feature Modules
    subgraph "Feature Modules"
        direction TB
        Feature_Article["Article"]:::ui
        Feature_Chat["Chat"]:::ui
        Feature_Home["Home"]:::ui
        Feature_History["History"]:::ui
        Feature_Login["Login"]:::ui
        Feature_MyPage["MyPage"]:::ui
        Feature_Onboarding["Onboarding"]:::ui
        Feature_Splash["Splash"]:::ui
    end

    %% External Services
    subgraph "External Services"
        direction TB
        Ext_Backend["REST API"]:::external
        Ext_Keychain["Keychain Storage"]:::external
        Ext_Social["Social Login Providers"]:::external
    end

    %% Compile-time dependency arrows
    TI_Plugins -->|generates| App_Project
    TI_Plugins -->|generates| Core_Common_Proj
    TI_Plugins -->|generates| Core_Domain_Proj
    TI_Plugins -->|generates| Core_Network_Proj
    TI_Plugins -->|generates| Shared_DesignSystem
    TI_Plugins -->|generates| Shared_ThirdParty
    TI_Plugins -->|generates| Shared_Utils
    TI_Plugins -->|generates| Feature_Article
    TI_Plugins -->|generates| Feature_Chat
    TI_Plugins -->|generates| Feature_Home
    TI_Plugins -->|generates| Feature_History
    TI_Plugins -->|generates| Feature_Login
    TI_Plugins -->|generates| Feature_MyPage
    TI_Plugins -->|generates| Feature_Onboarding
    TI_Plugins -->|generates| Feature_Splash

    %% Runtime flow
    User[/"User"/]:::external -->|taps UI| App_RootView
    App_RootView -->|"dispatch Action"| Feature_Home
    Feature_Home -->|"calls Store"| Feature_Home_Store
    class Feature_Home_Store internal
    Feature_Home_Store -->|"uses Domain Models"| Core_Domain
    Core_Domain -->|"invokes APIClient"| Core_Network
    Core_Network -->|"HTTP Request"| Ext_Backend
    Ext_Backend -->|"HTTP Response"| Core_Network
    Core_Network -->|"maps DTOs"| Core_Domain
    Core_Domain -->|"updates State"| Feature_Home_Store
    Feature_Home_Store -->|"renders View"| Feature_Home

    %% Shared usage
    Shared_DesignSystem -->|UI components| App_RootView
    Shared_DesignSystem -->|UI components| Feature_Article
    Shared_DesignSystem -->|UI components| Feature_Chat
    Shared_DesignSystem -->|UI components| Feature_Home
    Shared_Utils -->|helpers| Core_Common
    Shared_ThirdParty -->|libs| App_Project

    %% Keychain and Social login
    Feature_Login -->|"uses KeychainClient"| Ext_Keychain
    Feature_Login -->|"uses SocialLogin"| Ext_Social

    %% Click Events
    click TI_Plugins "https://github.com/ddd-community/ddd11-sclass-ios/tree/develop/Plugins/"
    click TI_Config "https://github.com/ddd-community/ddd11-sclass-ios/blob/develop/Tuist/Config.swift"
    click TI_Workspace "https://github.com/ddd-community/ddd11-sclass-ios/blob/develop/WorkSpace.swift"
    click App_Project "https://github.com/ddd-community/ddd11-sclass-ios/blob/develop/Projects/App/Project.swift"
    click App_Delegate "https://github.com/ddd-community/ddd11-sclass-ios/blob/develop/Projects/App/Sources/Application/AppDelegate.swift"
    click App_RootApp "https://github.com/ddd-community/ddd11-sclass-ios/blob/develop/Projects/App/Sources/Root/RootApp.swift"
    click App_RootStore "https://github.com/ddd-community/ddd11-sclass-ios/blob/develop/Projects/App/Sources/Root/RootStore.swift"
    click App_RootView "https://github.com/ddd-community/ddd11-sclass-ios/blob/develop/Projects/App/Sources/Root/RootView.swift"
    click App_Resources "https://github.com/ddd-community/ddd11-sclass-ios/tree/develop/Projects/App/Resources/"
    click Core_Common_Proj "https://github.com/ddd-community/ddd11-sclass-ios/blob/develop/Projects/Core/Common/Project.swift"
    click Core_Domain_Proj "https://github.com/ddd-community/ddd11-sclass-ios/blob/develop/Projects/Core/Domain/Project.swift"
    click Core_Network_Proj "https://github.com/ddd-community/ddd11-sclass-ios/blob/develop/Projects/Core/Network/Project.swift"
    click Shared_DesignSystem "https://github.com/ddd-community/ddd11-sclass-ios/blob/develop/Projects/Shared/DesignSystem/Project.swift"
    click Shared_ThirdParty "https://github.com/ddd-community/ddd11-sclass-ios/blob/develop/Projects/Shared/ThirdPartyLib/Project.swift"
    click Shared_Utils "https://github.com/ddd-community/ddd11-sclass-ios/blob/develop/Projects/Shared/Utils/Project.swift"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#005bbb,color:#005bbb
    classDef domain fill:#d4edda,stroke:#2e7d32,color:#2e7d32
    classDef network fill:#fff3cd,stroke:#e65100,color:#e65100
    classDef shared fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef infra fill:#f3e5f5,stroke:#6a1b9a,color:#6a1b9a
    classDef external fill:#f8d7da,stroke:#c62828,color:#c62828
```
