# gleapsdk/gleap-ios-sdk architecture

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

- Interactive diagram: https://gitdiagram.com/gleapsdk/gleap-ios-sdk
- Repository: https://github.com/gleapsdk/gleap-ios-sdk

## Overview

##### Main Components

a. Core SDK Layer:
- GleapCore as the central component
- Initialization and configuration flow
- Token-based authentication system

b. Feature Modules (Group these logically):
- Session Management (GleapSession, GleapSessionHelper)
- UI Components (GleapFrameManager, GleapUIHelper, GleapUIOverlay)
- Data Collection (GleapScreenCapture, GleapHttpTrafficRecorder, GleapConsoleLog)
- Feedback System (GleapFeedback, GleapFeedbackButton)
- AI Tools (GleapAiTool, GleapAiToolParameter)

c. Helper Systems:
- Event Management (GleapEventLogHelper)
- Configuration Management (GleapConfigHelper)
- Data Management (GleapCustomDataHelper, GleapExternalDataHelper)

**┌─────────────────────────────────────────────┐**
- Host iOS App                 │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Gleap SDK Core                 │
- ┬──────────────┬───────────────┤
- UI Layer   │ Data Layer   │ Network Layer │
- ┴──────────────┴───────────────┘
- ↕
**┌─────────────────────────────────────────────┐**
- Gleap Backend                  │
- ┘

##### Component Relationships

- Initialization flow
- Data flow for bug reports
- User interaction handling
- Network communications

##### Detailed Component Breakdown

- Feature modules and their relationships
- Helper utilities and their purposes
- Data flow between components

##### Implementation Notes

- Version compatibility information
- Swift and Objective-C interoperability

This SDK is primarily focused on mobile integration, so emphasize the mobile-specific components and how they interact with the host application's lifecycle.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef ui fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#e67e22,stroke:#d35400,color:white
    classDef helper fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef security fill:#9b59b6,stroke:#8e44ad,color:white
    classDef app fill:#34495e,stroke:#2c3e50,color:white

    %% Host Application Layer
    subgraph Host
        APP[Host iOS App]
    end

    %% Core SDK Layer
    subgraph CoreSDK
        Core["GleapCore"]:::core
        Security["Security Layer"]:::security
    end
    click Core "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapCore.h"
    click Security "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/PrivacyInfo.xcprivacy"

    %% Feature Modules
    subgraph Features
        direction TB
        
        %% Session Management
        subgraph SessionMgmt
            Session["GleapSession"]
            SessionHelper["SessionHelper"]
        end
        click Session "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapSession.h"
        click SessionHelper "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapSessionHelper.h"

        %% UI Components
        subgraph UIComponents
            FrameManager["FrameManager"]
            UIHelper["UIHelper"]
            UIOverlay["UIOverlay"]
        end
        click FrameManager "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapFrameManagerViewController.h"
        click UIHelper "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapUIHelper.h"
        click UIOverlay "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapUIOverlayHelper.h"

        %% Data Collection
        subgraph DataCollection
            HttpRecorder["HttpTrafficRecorder"]
            ScreenCapture["ScreenCapture"]
            ConsoleLog["ConsoleLog"]
        end
        click HttpRecorder "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapHttpTrafficRecorder.h"
        click ScreenCapture "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapScreenCaptureHelper.h"
        click ConsoleLog "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapConsoleLogHelper.h"

        %% Feedback System
        subgraph FeedbackSystem
            Feedback["GleapFeedback"]
            FeedbackBtn["FeedbackButton"]
        end
        click Feedback "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapFeedback.h"
        click FeedbackBtn "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapFeedbackButton.h"

        %% AI Tools
        subgraph AITools
            AiTool["GleapAiTool"]
            AiToolParam["AiToolParameter"]
        end
        click AiTool "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapAiTool.h"
        click AiToolParam "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapAiToolParameter.h"
    end

    %% Helper Systems
    subgraph Helpers
        direction TB
        EventLog["EventLogHelper"]
        ConfigHelper["ConfigHelper"]
        CustomData["CustomDataHelper"]
        ExternalData["ExternalDataHelper"]
    end
    click EventLog "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapEventLogHelper.h"
    click ConfigHelper "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapConfigHelper.h"
    click CustomData "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapCustomDataHelper.h"
    click ExternalData "https://github.com/GleapSDK/Gleap-iOS-SDK/blob/main/Sources/ObjCSources/GleapExternalDataHelper.h"

    %% Backend
    Backend["Gleap Backend"]

    %% Relationships
    APP --> Core
    Core --> Security
    Core --> Features
    Core --> Helpers
    Core --> Backend

    %% Style Applications
    class APP app
    class Core,Security core
    class Session,SessionHelper core
    class FrameManager,UIHelper,UIOverlay ui
    class HttpRecorder,ScreenCapture,ConsoleLog data
    class Feedback,FeedbackBtn ui
    class AiTool,AiToolParam core
    class EventLog,ConfigHelper,CustomData,ExternalData helper
    class Backend core

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["UI Components"]:::ui
        L3["Data Components"]:::data
        L4["Helper Components"]:::helper
        L5["Security Components"]:::security
    end
```
