# netcoresolutions/smartech-ios-sdk architecture

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

- Interactive diagram: https://gitdiagram.com/netcoresolutions/smartech-ios-sdk
- Repository: https://github.com/netcoresolutions/smartech-ios-sdk

## Overview

##### Core Components
- • SDK Framework (Smartech.xcframework): Represent this as the central library that iOS apps use for integration. Note that the framework includes headers for various protocols (e.g., HanselProtocol, SMTAppInboxProtocol, SMTBackendAPIRequest) that expose its key functionalities.
- • iOS App (Client): Mark an external “iOS Application” component that integrates the SDK.
- • Backend/External Services: Although not contained in the repository, the README and usage context indicate that the SDK communicates with Smartech’s backend services (e.g., for push notifications and in-app messages).
- • Podspec: Represent the podspec file as the distribution configuration, which is used by CocoaPods to manage integration in iOS projects.

##### Interactions and Data Flow
- Interactions from the SDK framework outward to the “Smartech Backend Services” (even if abstract) to show that tracked events, push notification tokens, or in-app message interactions are transmitted over the network.

##### Architectural Patterns and Key Design Principles
- Modularity provided by the framework. The SDK’s adoption of .xcframework makes it platform-agnostic (supporting multiple architectures like ios-arm64, maccatalyst, and simulator).
- Protocol-based design (as seen from the headers such as SmartechProtocol, SMTServiceOperation) — a design choice that allows developers to easily extend or customize behavior.
- Point out the clear separation of concerns: The SDK encapsulates communication with the backend, event handling, and notification management from the client app.

##### Following Elements
- The “iOS Application” that integrates the SDK.
- The “Smartech SDK Framework,” with internal modules (e.g., PushNotificationAdapter, AppInbox, Backend API, etc.).
- “Smartech Backend Services” as an external dependency that receives data or commands.
- API calls from the iOS app to the SDK.
- Data/command flow from the SDK to the backend.
- Any callback/response paths or event propagation.

##### Additional Recommendations
- Overlap architectural layers where appropriate — for instance, group all messaging and notification-related functionalities within one segment of the SDK.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Layer"
        iOSApp["iOS Application"]:::client
    end

    subgraph "SDK Layer"
        Framework["SDK Framework (Smartech.xcframework)"]:::framework
        subgraph "Internal Modules"
            PN["PushNotificationAdapter"]:::module
            AI["SMTAppInbox Module"]:::module
            BA["Backend API Services"]:::module
            PD["Protocol Definitions"]:::module
        end
        Podspec["Distribution Configuration (Podspec)"]:::config
    end

    subgraph "External Services"
        Backend["Smartech Backend Services"]:::external
    end

    iOSApp -->|"calls_SDK_API"| Framework
    Framework -->|"delegates_push_data"| Backend
    Framework -->|"transmits_event_data"| Backend

    Framework --- PN
    Framework --- AI
    Framework --- BA
    Framework --- PD

    PN -->|"handles_push_notifications"| Backend
    AI -->|"manages_in-app_messages"| Backend
    BA -->|"executes_backend_API_calls"| Backend

    %% Click Events
    click Framework "https://github.com/netcoresolutions/smartech-ios-sdk/blob/master/Frameworks/Smartech/Smartech.xcframework"
    click PN "https://github.com/netcoresolutions/smartech-ios-sdk/blob/master/Frameworks/Smartech/Smartech.xcframework/ios-arm64/Smartech.framework/Headers/PushNotificationAdapter.h"
    click AI "https://github.com/netcoresolutions/smartech-ios-sdk/blob/master/Frameworks/Smartech/Smartech.xcframework/ios-arm64/Smartech.framework/Headers/SMTAppInboxProtocol.h"
    click BA "https://github.com/netcoresolutions/smartech-ios-sdk/blob/master/Frameworks/Smartech/Smartech.xcframework/ios-arm64/Smartech.framework/Headers/SMTBackendAPIRequest.h"
    click PD "https://github.com/netcoresolutions/smartech-ios-sdk/blob/master/Frameworks/Smartech/Smartech.xcframework/ios-arm64/Smartech.framework/Headers/HanselProtocol.h"
    click Podspec "https://github.com/netcoresolutions/smartech-ios-sdk/blob/master/Smartech-iOS-SDK.podspec"

    %% Styles
    classDef client fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef framework fill:#82E0AA,stroke:#1D8348,stroke-width:2px;
    classDef module fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef config fill:#D7BDE2,stroke:#8E44AD,stroke-width:2px;
    classDef external fill:#F5B7B1,stroke:#943126,stroke-width:2px;
```
