# nativeapptemplate/nativeapptemplate-free-ios architecture

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

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

## Overview

##### Key Architectural Elements

a) Core Services:
**┌─────────────────┐**
- UI Layer      │
- ┬────────┘
- ↓
**┌─────────────────┐**
- Business Logic │
- ┬────────┘
- ↓
**┌─────────────────┐**
- Data Layer    │
- ┬────────┘
- ↓
**┌─────────────────┐**
- External API    │
- ┘

b) Data Flow:
- CRUD operations for Shops
- Authentication flow
- Session management
- API communication

##### Specific Implementation Details

Key technical components:

a) Networking Layer:
- JSONAPI implementation
- Request/Response adapters
- Services (AccountPassword, Me, Permissions, Shops)

b) Persistence:
- KeychainStore for secure storage
- Local data caching

c) Authentication:
- Login/SignUp flows
- Session management
- Password reset functionality

##### Component Relationships

Key interactions:
**UI Components ←→ ViewModels**
**ViewModels ←→ Repositories**
**Repositories ←→ Network/Persistence**
**Network Layer ←→ External API**

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef business fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#e74c3c,stroke:#c0392b,color:white
    classDef utility fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Main Layers
    subgraph UI["Presentation Layer"]
        AppRoot["App Root"]:::ui
        ShopViews["Shop Views"]:::ui
        Settings["Settings"]:::ui
        EmptyStates["Empty States"]:::ui
        SharedComponents["Shared Components"]:::ui
    end

    subgraph BL["Business Logic Layer"]
        ViewModels["ViewModels"]:::business
        SessionMgmt["Session Management"]:::business
        DataMgmt["Data Management"]:::business
    end

    subgraph DL["Data Layer"]
        Repositories["Repositories"]:::data
        NetworkCore["Networking Core"]:::data
        Persistence["Persistence"]:::data
    end

    subgraph Auth["Authentication"]
        Login["Login Component"]:::business
        KeychainStore["Keychain Storage"]:::data
    end

    subgraph Network["Network Services"]
        APIServices["API Services"]:::data
        JSONAPI["JSONAPI Implementation"]:::data
        RequestHandlers["Request Handlers"]:::data
        EntityAdapters["Entity Adapters"]:::data
    end

    subgraph Utility["Utility Components"]
        Logging["Logging"]:::utility
        Extensions["Extensions"]:::utility
        StyleGuide["Style Guide"]:::utility
        MessageBus["Message Bus"]:::utility
    end

    %% Relationships
    AppRoot --> ViewModels
    ShopViews --> ViewModels
    Settings --> ViewModels
    ViewModels --> Repositories
    SessionMgmt --> KeychainStore
    DataMgmt --> Repositories
    Repositories --> NetworkCore
    Repositories --> Persistence
    NetworkCore --> APIServices
    APIServices --> JSONAPI
    JSONAPI --> RequestHandlers
    RequestHandlers --> EntityAdapters
    Login --> SessionMgmt
    SharedComponents --> StyleGuide

    %% External API
    ExternalAPI["External API"]:::external
    NetworkCore --> ExternalAPI

    %% Click events
    click AppRoot "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/UI/App Root/"
    click ShopViews "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/UI/Shop List/"
    click Settings "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/UI/Settings/"
    click EmptyStates "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/UI/Empty States/"
    click SharedComponents "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/UI/Shared/"
    click ViewModels "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/Data/ViewModels/"
    click SessionMgmt "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/blob/main/NativeAppTemplate/Sessions/SessionController.swift"
    click DataMgmt "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/blob/main/NativeAppTemplate/Data/DataManager.swift"
    click Repositories "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/Data/Repositories/"
    click NetworkCore "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/Networking/Network/"
    click Persistence "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/Persistence/KeychainStore/"
    click Login "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/Login/"
    click KeychainStore "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/Persistence/KeychainStore/"
    click APIServices "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/Networking/Services/"
    click JSONAPI "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/Networking/JSONAPI/"
    click RequestHandlers "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/Networking/Requests/"
    click EntityAdapters "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/Networking/Adapters/EntityAdapters/"
    click Logging "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/Logging/"
    click Extensions "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/Extensions/"
    click StyleGuide "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/tree/main/NativeAppTemplate/Styleguide/"
    click MessageBus "https://github.com/nativeapptemplate/NativeAppTemplate-Free-iOS/blob/main/NativeAppTemplate/Utilities/MessageBus.swift"
```
