# xbmc/official-kodi-remote-ios architecture

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

- Interactive diagram: https://gitdiagram.com/xbmc/official-kodi-remote-ios
- Repository: https://github.com/xbmc/official-kodi-remote-ios

## Overview

##### Project Type and Purpose
- This is a native iOS client (“Official-Kodi-Remote-iOS”) built in Objective-C/Xcode.
- Its purpose is to let an iOS device browse and control one or more remote Kodi (XBMC) media-center instances via JSON-RPC over TCP/IP.
- It’s a single, monolithic mobile app (no custom backend), organized using the MVC pattern, with a network layer, a presentation layer (ViewControllers/XIBs), and third-party libraries for UI and caching.

##### Top-Level Structure
- Xcode Project (Kodi Remote.xcodeproj)
- App code in “XBMC Remote/…”:
- ViewControllers & UI resources (XIBs, storyboards)
- AppDelegate, navigation controllers
- Custom Views & Cells (e.g. PosterCell, BroadcastProgressView)
- Categories and Utilities (NSString+MD5, UIImage+Resize)
- Network module (RemoteController, DSJSONRPC, tcpJSONRPC, low-level headers in Network/)
- Data module (GlobalData, NowPlaying)
- Third-party subfolders:
- SDWebImage (image caching/download)
- SVPullToRefresh (pull-to-refresh)
- ECSlidingViewController, BDKCollectionIndexView, OBShapedButton, OBSlider, JBKenBurnsView
- Demiurgic-JSON-RPC (RPC messaging)
- Settings.bundle (in-app preferences)
- fastlane and .github/workflows/ci.yml (CI/CD pipelines for TestFlight/AppStore)

##### Key Architectural Patterns
- MVC (Model: GlobalData/JSONRPC-parsed objects; View: XIBs/Views; Controller: ViewControllers, RemoteController)
- Delegate/callbacks for JSON-RPC responses
- Layered separation:
- Presentation (ViewControllers → UIKit)
- Business/networking (RemoteController + JSONRPC layers)
- Data/Cache (GlobalData, SDImageCache, NSUserDefaults)
- External integration: communicates over TCP sockets (json over TCP) to Kodi’s JSON-RPC API

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        Presentation["ViewControllers & UI Resources"]:::frontend
    end

    %% Network Layer
    subgraph "Network Layer"
        direction TB
        RemoteController["RemoteController"]:::api
        tcpJSONRPC["tcpJSONRPC"]:::api
        DSJSONRPC["DSJSONRPC"]:::api
    end

    %% Data Layer
    subgraph "Data & Cache Layer"
        direction TB
        GlobalData["GlobalData"]:::data
        NowPlaying["NowPlaying"]:::data
        SDImageCache["SDImageCache"]:::data
    end

    %% Utilities & Categories
    subgraph "Utilities & Categories"
        direction TB
        NSStringMD5["NSString+MD5"]:::util
        UIImageResize["UIImage+Resize"]:::util
        ConvenienceMacros["ConvenienceMacros.h"]:::util
        UtilitiesFile["Utilities"]:::util
    end

    %% Third-Party Libraries
    subgraph "Third-Party Libraries"
        direction TB
        SDWebImage["SDWebImage"]:::thirdparty
        SVPullToRefresh["UIScrollView+SVPullToRefresh"]:::thirdparty
        ECSliding["ECSlidingViewController"]:::thirdparty
        BDKCollection["BDKCollectionIndexView"]:::thirdparty
        OBShapedButton["OBShapedButton"]:::thirdparty
        OBSlider["OBSlider"]:::thirdparty
        KenBurns["JBKenBurnsView"]:::thirdparty
    end

    %% External Service
    Kodi["Kodi Media Center\n(JSON-RPC over TCP)"]:::external

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        direction TB
        GitHubActions["GitHub Actions"]:::cicd
        Fastlane["fastlane"]:::cicd
    end

    %% Xcode Project & Config
    XcodeProject["Kodi Remote.xcodeproj"]:::util
    AppConfig["Main / Info.plist / Prefix.pch"]:::util

    %% Relationships
    Presentation -->|invokes RPC| RemoteController
    RemoteController -->|uses| tcpJSONRPC
    RemoteController -->|parses| DSJSONRPC
    tcpJSONRPC -->|sends JSON| Kodi
    Kodi -->|returns JSON| DSJSONRPC
    DSJSONRPC -->|callbacks| Presentation
    Presentation -->|reads/writes| GlobalData
    Presentation -->|reads/writes| NowPlaying
    Presentation -->|loads images via| SDImageCache
    Presentation -->|utils| NSStringMD5
    Presentation -->|utils| UIImageResize
    Presentation -->|utils| UtilitiesFile
    Presentation -->|utils| ConvenienceMacros
    Presentation -->|includes| SDWebImage
    Presentation -->|includes| SVPullToRefresh
    Presentation -->|includes| ECSliding
    Presentation -->|includes| BDKCollection
    Presentation -->|includes| OBShapedButton
    Presentation -->|includes| OBSlider
    Presentation -->|includes| KenBurns

    GitHubActions -->|triggers| Fastlane
    Fastlane -->|deploys to| AppConfig

    %% Click Events
    click Presentation "https://github.com/xbmc/official-kodi-remote-ios/tree/master/XBMC Remote/"
    click RemoteController "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/RemoteController.m"
    click tcpJSONRPC "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/tcpJSONRPC.m"
    click DSJSONRPC "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/dbowen-Demiurgic-JSON-RPC-168ecc9/DSJSONRPC.m"
    click GlobalData "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/GlobalData.m"
    click NowPlaying "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/NowPlaying.m"
    click SDImageCache "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/SDWebImage/SDImageCache.m"
    click NSStringMD5 "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/NSString+MD5/NSString+MD5.m"
    click UIImageResize "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/UIImage+Resize/UIImage+Resize.m"
    click ConvenienceMacros "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/ConvenienceMacros.h"
    click UtilitiesFile "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/Utilities.m"
    click SDWebImage "https://github.com/xbmc/official-kodi-remote-ios/tree/master/XBMC Remote/SDWebImage/"
    click SVPullToRefresh "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/SVPullToRefresh/UIScrollView+SVPullToRefresh.m"
    click ECSliding "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/ECSlidingViewController/ECSlidingViewController.m"
    click BDKCollection "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/BDKCollectionIndexView/BDKCollectionIndexView.m"
    click OBShapedButton "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/OBShapedButton/OBShapedButton.m"
    click OBSlider "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/OBSlider/OBSlider.m"
    click KenBurns "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/KenBurns/JBKenBurnsView.m"
    click XcodeProject "https://github.com/xbmc/official-kodi-remote-ios/tree/master/Kodi Remote.xcodeproj/"
    click AppConfig "https://github.com/xbmc/official-kodi-remote-ios/blob/master/XBMC Remote/Kodi Remote-Info.plist"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,color:#004085;
    classDef api fill:#d4edda,stroke:#155724,color:#155724;
    classDef data fill:#fff3cd,stroke:#856404,color:#856404;
    classDef util fill:#e2e3e5,stroke:#383d41,color:#383d41;
    classDef thirdparty fill:#f8d7da,stroke:#721c24,color:#721c24;
    classDef external fill:#d1ecf1,stroke:#0c5460,color:#0c5460;
    classDef cicd fill:#f5e1ff,stroke:#5e005e,color:#5e005e;
```
