# poppool/ios architecture

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

- Interactive diagram: https://gitdiagram.com/poppool/ios
- Repository: https://github.com/poppool/ios

## Overview

##### Project Type and Purpose
- This is a native iOS client application (“Poppool”) built in Swift using Xcode 16.2 targeting iOS 16+.
- It follows Clean Architecture and MVVM(+ReactorKit) principles to present pop-up store information and integrate with Instagram.

##### File-Structure Analysis
- CoreLayer/Infrastructure: Dependency Injection container, extensions, logging, image-loading (memory/disk), secrets, KeyChain & UserDefaults services.
- DataLayer/Data: Network stack (API endpoints, DTOs, interceptors, providers), Service protocols (Auth, Apple/Kakao login, Pre-Signed URLs), Repository implementations.
- DomainLayer/Domain: UseCase interfaces & implementations, Entity definitions, Repository interfaces.
- PresentationLayer/Presentation: UI components (Views, ViewControllers, Reactors), DesignSystem, common Utilities (map clustering, toasts, base controllers).
- Top-level: Poppool/Application (AppDelegate, SceneDelegate), Resources (assets, fonts, strings).

##### README Insights
- Confirms it’s a mobile client that fetches scattered pop-up store data and offers Instagram-linked features.
- No backend code—relies on RESTful APIs, social-login providers, map services.

##### Main Components
a. Presentation Layer
- Views & ViewControllers (PresentationLayer/Presentation)
- Reactors (MVVM ViewModels)
b. Domain Layer
- UseCase interfaces & implementations
- Entities & Repository interfaces
c. Data Layer
- RepositoryImpl classes
- Network: Provider, Interceptor, EndPoint, API modules
- Service protocols: AuthServiceable, AppleLoginService, etc.
d. Infrastructure Layer
- DIContainer
- ImageLoader (Memory + Disk)
- Logger
- Secrets management, KeyChainService, UserDefaultService
e. External Services
- Backend REST API endpoints (Auth, Home, Map, PopUp, Comment, User, Admin, SignUp, PreSigned)
- Social-login providers: Apple, Kakao
- SDKs/APIs (AppleMap, TMap, Naver, Kakao)
- Instagram integration

##### Relationships & Data Flow
- UI (ViewControllers/Reactors) → invokes Domain UseCases → calls Repository interfaces → implemented by DataLayer → uses Network Provider & Services → sends HTTP to External Backend / Third-party APIs → maps JSON to DTOs → converts to Domain Entities → back up the stack to UI.
- DIContainer wires ViewControllers, Reactors, UseCases, Repositories, Services.
- ImageLoader caches images locally (disk & memory), injected wherever needed.
- KeyChainService/UserDefaultService persist tokens, settings.

##### Architectural Patterns & Principles
- Clean Architecture: strict layer separation (Presentation → Domain → Data → Infrastructure).
- MVVM(+ReactorKit): PresentationLayer uses Reactors/ViewModels for state management.
- Dependency Injection: CoreLayer/Infrastructure/DIContainer provides all dependencies.
- Single Responsibility: each module (e.g., AdminAPI, HomeAPI) encapsulates its own endpoint definitions and DTOs.
- Open/Closed: new API modules can be added without touching existing code.

##### Technologies & Frameworks
- Swift 5.9, Xcode 16.2, iOS 16+
- ReactorKit (MVVM), RxSwift (reactive extensions)
- URLSession or custom network provider
- AppleMap SDK, Kakao SDK, Naver SDK (via wrappers)
- Instagram SDK (for social integration)

##### Essential Elements
- Clear component labels (e.g., “HomeAPIRepositoryImpl,” “CommentReactor”).
- Notes on protocols/interfaces vs. implementations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        AppEntry["AppDelegate & SceneDelegate"]:::presentation
        ViewsVCs["Views & ViewControllers"]:::presentation
        Reactors["Reactors (ViewModels)"]:::presentation
        DesignSystem["DesignSystem"]:::presentation
        CommonUtils["Common Utilities"]:::presentation
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        UseCaseInt["UseCase Interfaces"]:::domain
        UseCaseImpl["UseCase Implementations"]:::domain
        Entities["Entity Definitions"]:::domain
        RepoInt["Repository Interfaces"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        RepoImpl["Repository Implementations"]:::data
        NetProvider["Network Provider"]:::data
        TokenInterceptor["HTTP Interceptor"]:::data
        EndPoints["Endpoint Definitions"]:::data
        APIModules["API Modules"]:::data
        ServiceProtocols["Service Protocols"]:::data
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        direction TB
        DIContainer["DIContainer"]:::infra
        ImageLoader["ImageLoader"]:::infra
        Logger["Logger"]:::infra
        Secrets["Secrets Management"]:::infra
        PersistenceServices["KeyChain & UserDefaults"]:::infra
    end

    %% External Services
    subgraph "External Services"
        direction TB
        BackendAPI["Backend REST APIs"]:::external
        AppleLogin["Apple Login SDK"]:::external
        KakaoLogin["Kakao Login SDK"]:::external
        MapSDKs["Map SDKs (Apple, TMap, Naver, Kakao)"]:::external
        InstagramSDK["Instagram SDK"]:::external
    end

    %% Connections
    AppEntry -->|initializes| DIContainer
    DIContainer -->|injects| ViewsVCs
    DIContainer -->|injects| Reactors
    DIContainer -->|injects| UseCaseImpl
    DIContainer -->|injects| RepoImpl
    DIContainer -->|injects| NetProvider
    DIContainer -->|injects| ImageLoader
    ViewsVCs -->|binds to| Reactors
    Reactors -->|calls| UseCaseInt
    UseCaseInt -->|implemented by| UseCaseImpl
    UseCaseImpl -->|uses| RepoInt
    RepoInt -->|implemented by| RepoImpl
    RepoImpl -->|uses| NetProvider
    NetProvider -->|intercepts with| TokenInterceptor
    NetProvider -->|calls| EndPoints
    EndPoints -->|groups| APIModules
    RepoImpl -->|uses| ServiceProtocols
    NetProvider -->|HTTP calls| BackendAPI
    ServiceProtocols -->|SDK calls| AppleLogin
    ServiceProtocols -->|SDK calls| KakaoLogin
    ViewsVCs -->|renders maps via| MapSDKs
    ViewsVCs -->|integrates| InstagramSDK
    ViewsVCs -->|loads images via| ImageLoader
    ViewsVCs -->|stores tokens via| PersistenceServices
    Logger -->|logs events for| NetProvider
    Secrets -->|provides configs to| DIContainer

    %% Click Events
    click ViewsVCs "https://github.com/poppool/ios/tree/develop/Poppool/PresentationLayer/Presentation/Presentation/Scene"
    click Reactors "https://github.com/poppool/ios/tree/develop/Poppool/PresentationLayer/Presentation/Presentation/Scene"
    click DesignSystem "https://github.com/poppool/ios/tree/develop/Poppool/PresentationLayer/Presentation/Presentation/DesignSystem"
    click CommonUtils "https://github.com/poppool/ios/tree/develop/Poppool/PresentationLayer/Presentation/Presentation/Utills"
    click UseCaseInt "https://github.com/poppool/ios/tree/develop/Poppool/DomainLayer/Domain/DomainInterface/UseCase"
    click UseCaseImpl "https://github.com/poppool/ios/tree/develop/Poppool/DomainLayer/Domain/Domain/UseCaseImpl"
    click Entities "https://github.com/poppool/ios/tree/develop/Poppool/DomainLayer/Domain/DomainInterface/Entity"
    click RepoInt "https://github.com/poppool/ios/tree/develop/Poppool/DomainLayer/Domain/DomainInterface/Repository"
    click NetProvider "https://github.com/poppool/ios/blob/develop/Poppool/DataLayer/Data/Data/Network/Provider/Provider.swift"
    click NetProvider "https://github.com/poppool/ios/blob/develop/Poppool/DataLayer/Data/Data/Network/Provider/ProviderImpl.swift"
    click TokenInterceptor "https://github.com/poppool/ios/blob/develop/Poppool/DataLayer/Data/Data/Network/Interceptor/TokenInterceptor.swift"
    click EndPoints "https://github.com/poppool/ios/tree/develop/Poppool/DataLayer/Data/Data/Network/EndPoint/"
    click APIModules "https://github.com/poppool/ios/tree/develop/Poppool/DataLayer/Data/Data/Network/API/"
    click ServiceProtocols "https://github.com/poppool/ios/tree/develop/Poppool/DataLayer/Data/Data/Network/Service"
    click RepoImpl "https://github.com/poppool/ios/tree/develop/Poppool/DataLayer/Data/Data/RepositoryImpl"
    click DIContainer "https://github.com/poppool/ios/tree/develop/Poppool/CoreLayer/Infrastructure/Infrastructure/DIContainer"
    click ImageLoader "https://github.com/poppool/ios/tree/develop/Poppool/CoreLayer/Infrastructure/Infrastructure/ImageLoader"
    click Logger "https://github.com/poppool/ios/blob/develop/Poppool/CoreLayer/Infrastructure/Infrastructure/Logger/Logger.swift"
    click Secrets "https://github.com/poppool/ios/blob/develop/Poppool/CoreLayer/Infrastructure/Infrastructure/Secrets.swift"
    click PersistenceServices "https://github.com/poppool/ios/tree/develop/Poppool/CoreLayer/Infrastructure/Infrastructure/Service"
    click AppEntry "https://github.com/poppool/ios/blob/develop/Poppool/Poppool/Application/AppDelegate.swift"
    click AppEntry "https://github.com/poppool/ios/blob/develop/Poppool/Poppool/Application/SceneDelegate.swift"
    click Resources "https://github.com/poppool/ios/tree/develop/Poppool/Poppool/Resource"

    %% Styles
    classDef presentation fill:#bbdefb,stroke:#1e88e5,color:#0d47a1;
    classDef domain fill:#c8e6c9,stroke:#43a047,color:#1b5e20;
    classDef data fill:#ffe0b2,stroke:#fb8c00,color:#e65100;
    classDef infra fill:#eceff1,stroke:#78909c,color:#263238;
    classDef external fill:#fff9c4,stroke:#fdd835,color:#f57f17;
```
