# md-owais-07/truckx-ios-application architecture

> Architecture diagram of the GitHub repository md-owais-07/truckx-ios-application, 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/md-owais-07/truckx-ios-application
- Repository: https://github.com/md-owais-07/truckx-ios-application

## Overview

##### Project type and purpose
- This is a native iOS mobile-client application (“TruckX iOS APP”) built in Xcode using UIKit, Core Data and RESTful networking.
- Its feature set (Login/Register, HOS info, cycle info, exemptions, chat, carrier info, chart details, etc.) indicates a logistics/trucking-workflow management tool.

##### File structure
- Top-level Xcode project container: “TruckX iOS Application.xcodeproj” and workspace files.
- “Common”: AppDelegate.swift, SceneDelegate.swift → application lifecycle.
- “Controllers”: one UIViewController subclass per feature, grouped by feature folder (Login, Register, Tabbar → Home/Logbook/Messages/More, ChartDetails, CycleInformation, Exemptions, etc.).
- “Models”: Swift structs/classes for request/response payloads and view cell data.
- “Services/Networking”: APIManager + discrete service classes (AuthService, UserService, ExemptionService) encapsulating URLSession calls.
- “Supporting Files”:
- Core: global enums, AppInfo, UserData storage stubs
- Extensions: UIKit/UIViewController/UIButton/UITableView extension helpers
- Helper/Managers: custom presentation, image downloading, location updates, notification scheduling, Lottie loading
- Network: low-level Api, ApiModel, ApiResponse, Network wrapper
- UI Components: reusable buttons, loader view
- Utilities: AppController, BaseViewController
- “Views”: custom UIView subclasses, XIBs and Storyboards.
- Core Data model in “TruckX_iOS_Application.xcdatamodeld”.
- “Resources”: asset catalog, storyboards, Info.plist, animations (Lottie JSON).

##### How to represent this
1. Presentation Layer (UI)
– Storyboards & XIBs
– UIViewControllers (Controllers/Tabbar/Home/…/ChartDetails)
– Custom Views & UI Components
2. Domain Layer
– Models (request/response/view-model structs)
– Managers & Helpers (LocationManager, NotificationManager, LottieLoaderManager)
3. Services Layer
– APIManager
– AuthService, UserService, ExemptionService
– Network wrapper (Api, ApiModel, ApiResponse)
4. Data Persistence Layer
– Core Data stack (TruckX_iOS_Application.xcdatamodeld)
– Local caching via UserData/AppInfo
5. External Systems
– Backend REST API endpoints
– Push notification service (APNs)
– Location services (iOS CoreLocation)
– User taps UI → UIViewController methods
– UIViewController → calls Service (e.g. AuthService.signIn)
– Service → APIManager → Network → HTTP request → External Backend
– HTTP response → Network → ApiResponse → Service → Model
– Service writes/reads Model to/from Core Data
– LocationManager → CoreLocation → provides geolocation to Controllers or Services
– Controller → updates UI (views, custom components, Lottie animations)
c. Architectural patterns & principles:
– MVC: controllers mediate between view and model
– Single Responsibility: each Service and Manager has one concern
– Dependency Separation: Presentation → Domain → Services → Persistence
– Asynchronous calls: Network layer handles callback/closure pattern
– Reusability: shared UI Components, Extensions
d. Key technologies/frameworks:
– UIKit, XIBs, Storyboards
– URLSession wrapped in APIManager
– Core Data for offline cache
– Lottie for in-app animations
– CoreLocation for geolocation
– APNs for push notifications

- Major pieces (Controllers, Services, Models, Persistence, External).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        LoginVC["LoginVC"]:::presentation
        RegisterVC["RegisterVC"]:::presentation
        TabBarVC["TabBarVC"]:::presentation
        HomeVC["HomeVC"]:::presentation
        MainSB["Main.storyboard"]:::presentation
        BaseSB["Base.lproj/Main.storyboard"]:::presentation
        ChatTVC["ChatTVC.xib"]:::presentation
        ExemptionTVC["ExemptionTVC.xib"]:::presentation
        CircularProgressView["CircularProgressView"]:::presentation
        ReusableGraphView["ReusableGraphView"]:::presentation
        CustomUIButtons["CustomUIButtons"]:::presentation
        LoaderView["LoaderView"]:::presentation
        AppDelegate["AppDelegate.swift"]:::lifecycle
        SceneDelegate["SceneDelegate.swift"]:::lifecycle
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        SignInResponse["SignInResponse"]:::domain
        CreateUserModel["CreateUserModel"]:::domain
        ExemptionModel["ExemptionModel"]:::domain
        CellData["CellData"]:::domain
        LocationManager["LocationManager"]:::domain
        NotificationManager["NotificationManager"]:::domain
        LottieLoaderManager["LottieLoaderManager"]:::domain
        ImageDownloader["ImageDownloader"]:::domain
        CustomSheetPresentationController["CustomSheetPresentationController"]:::domain
    end

    %% Services Layer
    subgraph "Services Layer"
        direction TB
        APIManager["APIManager"]:::services
        AuthService["AuthService"]:::services
        UserService["UserService"]:::services
        ExemptionService["ExemptionService"]:::services
        ApiWrapper["Api"]:::services
        ApiModel["ApiModel"]:::services
        ApiResponse["ApiResponse"]:::services
        Network["Network"]:::services
    end

    %% Persistence Layer
    subgraph "Data Persistence Layer"
        direction TB
        CoreData["TruckX_iOS_Application.xcdatamodeld"]:::persistence
        UserData["UserData.swift"]:::persistence
        AppInfo["AppInfo.swift"]:::persistence
        Enumerations["Enumerations.swift"]:::persistence
    end

    %% External Systems
    subgraph "External Systems"
        direction TB
        Backend["REST API Backend"]:::external
        APNs["APNs (Push Notification)"]:::external
        CoreLocation["iOS CoreLocation"]:::external
    end

    %% Relationships
    LoginVC -->|uses models| SignInResponse
    RegisterVC -->|uses models| CreateUserModel
    LoginVC -->|navigates via| MainSB
    HomeVC -->|loads via| BaseSB
    HomeVC -->|renders| ReusableGraphView
    HomeVC -->|renders| CircularProgressView
    ExemptionTVC -->|instantiates| ExemptionModel
    LoginVC -->|calls| AuthService
    RegisterVC -->|calls| UserService
    AuthService -->|uses| APIManager
    UserService -->|uses| APIManager
    ExemptionService -->|uses| APIManager
    APIManager -->|wraps| Network
    Network -->|sends HTTP| Backend
    Network -->|parses| ApiResponse
    ApiResponse -->|delivers| ServiceModel["Model"]:::services
    APIManager -->|builds request via| ApiWrapper
    APIManager -->|uses| ApiModel
    AuthService -->|saves to| CoreData
    ExemptionService -->|reads from| CoreData
    LocationManager -->|requests| CoreLocation
    NotificationManager -->|schedules| APNs
    LoginVC -->|presents| LoaderView
    HomeVC -->|presents| CustomUIButtons
    CustomSheetPresentationController -->|used by| LoginVC
    ImageDownloader -->|provides to| HomeVC
    LottieLoaderManager -->|animates| HomeVC
    AppDelegate -->|initializes| APIManager
    SceneDelegate -->|loads UI| LoginVC

    %% Layer arrows
    PresentationLayer["Presentation Layer"] -->|calls| DomainLayer["Domain Layer"]
    DomainLayer -->|calls| ServicesLayer["Services Layer"]
    ServicesLayer -->|stores| PersistenceLayer["Data Persistence Layer"]
    ServicesLayer -->|communicates| ExternalSystems["External Systems"]

    %% Click Events
    click LoginVC "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Controllers/Login/LoginVC.swift"
    click RegisterVC "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Controllers/Register/RegisterVC.swift"
    click TabBarVC "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Controllers/Tabbar/TabbarVC/TabBarVC.swift"
    click HomeVC "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Controllers/Tabbar/Home/HomeVC.swift"
    click MainSB "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Controllers/LandingPage/Main.storyboard"
    click BaseSB "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Views/Storyboards/Base.lproj/Main.storyboard"
    click ChatTVC "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Views/Xibs/ChatTVC.xib"
    click ExemptionTVC "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Views/Xibs/ExemptionTVC.xib"
    click CircularProgressView "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Views/Custom Views/CircularProgressView.swift"
    click ReusableGraphView "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Views/Custom Views/ReusableGraphView.swift"
    click CustomUIButtons "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/UI Components/CustomUIButtons.swift"
    click LoaderView "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/UI Components/LoaderView.swift"
    click SignInResponse "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Models/SignInResponse.swift"
    click CreateUserModel "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Models/CreateUserModel.swift"
    click ExemptionModel "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Models/ExemptionModel.swift"
    click CellData "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Models/CellData.swift"
    click LocationManager "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/Managers/LocationManager.swift"
    click NotificationManager "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/Managers/NotificationManager.swift"
    click LottieLoaderManager "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/Managers/LottieLoaderManager.swift"
    click ImageDownloader "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/Helper/ImageDownloader.swift"
    click CustomSheetPresentationController "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/Helper/CustomSheetPresentationController.swift"
    click APIManager "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Services/Networking/Api Manager/APIManager.swift"
    click AuthService "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Services/Networking/AuthService.swift"
    click UserService "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Services/Networking/UserService.swift"
    click ExemptionService "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Services/Networking/ExemptionService.swift"
    click ApiWrapper "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/Network/Api.swift"
    click ApiModel "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/Network/ApiModel.swift"
    click ApiResponse "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/Network/ApiResponse.swift"
    click Network "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/Network/Network.swift"
    click CoreData "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/TruckX_iOS_Application.xcdatamodeld"
    click UserData "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/Core/UserData.swift"
    click AppInfo "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/Core/AppInfo.swift"
    click Enumerations "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Supporting Files/Core/Enumerations.swift"
    click AppDelegate "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Common/AppDelegate.swift"
    click SceneDelegate "https://github.com/md-owais-07/truckx-ios-application/blob/main/TruckX iOS Application/Common/SceneDelegate.swift"

    %% Styles
    classDef presentation fill:#bbdefb,stroke:#1e88e5,color:#0d47a1
    classDef domain fill:#c8e6c9,stroke:#43a047,color:#1b5e20
    classDef services fill:#ffe0b2,stroke:#fb8c00,color:#e65100
    classDef persistence fill:#fff9c4,stroke:#fdd835,color:#f57f17
    classDef external fill:#eceff1,stroke:#607d8b,color:#263238
    classDef lifecycle fill:#d1c4e9,stroke:#7e57c2,color:#4a148c
```
