# mdausch/latchkey architecture

> Architecture diagram of the GitHub repository mdausch/latchkey, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mdausch/latchkey
- Repository: https://github.com/mdausch/latchkey

## Overview

##### Main components
- Tweak Core Module – This includes the source files such as LatchKey.xm, Latchkey.h, and the code under the “latchkey” directory (including controllers and plist configurations). These files collectively form the core of the tweak that is injected into the iOS system (likely into SpringBoard or the lock screen process).
- Themes Repository – Located under Layout/Library/Application Support/LatchKey/Themes, this component stores all available lock glyph themes, subdivided by iOS version (ios11 and ios12). Each theme bundle (e.g., Apple_Lock, Colored_Lock, Face_ID_White, etc.) contains its resources (assets, index.xml, main.caml, etc.) which define the appearance.
- Resource Management & Configuration – The project also contains several plist files (e.g., Info.plist, latchkeyPrefsMain.plist, entry.plist) for providing configuration details and user preferences. This is where options like glyph positioning and carrier-hiding are managed.
- Build and Packaging Infrastructure – The Makefiles, control file, and related build resources indicate how the tweak is compiled and packaged to be deployed via jailbreak repositories (like Packix).

##### Relationships and interactions between the components
- Meanwhile, user configurations specified in the plist files (and possibly set via a preferences panel that the tweak might provide) guide which themes to load and which customizations to apply. Represent this as a “Configuration / Preferences” component that supplies data to the Tweak Core Module.

##### Architectural patterns
- Modular Design – The separation of core functionality (the tweak itself) from visual themes (resource bundles) makes the system modular and extensible. This design pattern is important because it allows adding or modifying themes without touching the core logic.
- Resource Abstraction – The theme bundles are self-contained units (each with its .ca assets, index.xml, main.caml, etc.) and can be seen as plug‑ins to the main tweak module.
- Configuration Driven – The use of plist files for user settings indicates a design where runtime behavior is largely dictated by external configuration, enhancing flexibility.

##### Technologies and frameworks
- Objective-C/Logos (indicated by .xm files, which are usually associated with MobileSubstrate tweaks)
- iOS Framework-specific APIs for modifying the lock screen and interacting with SpringBoard.
- Standard iOS resource management with property lists and bundle packaging for themes.

##### Specific elements
- Clear labels for:
- “iOS System (Lock Screen/SpringBoard)”
- “Tweak Core Module” (including source components like LatchKey.xm, .h, and the controllers inside the latchkey directory)
- “Themes Repository” with its structure divided into iOS 11 and iOS 12 themes.
- “Configuration / Preferences” (pointing to the plist files)
- “Build & Packaging Tools” (Makefile, control file)
- Injection of the tweak into the iOS system,
- Loading of themes from the Themes Repository,
- Configuration settings flowing into the Tweak Core.
- Code modules (for the tweak core and controllers),
- Resource modules (theme bundles),
- Configuration and build modules.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Runtime Architecture"
        SYS["iOS System (Lock Screen/SpringBoard)"]:::system

        subgraph "Tweak Core Module"
            TC1["LatchKey.xm"]:::core
            TC2["Latchkey.h"]:::core
            subgraph "latchkey Directory"
                TC3["mdFeedbackController.h"]:::core
                TC4["mdFeedbackController.m"]:::core
                TC5["mdlkRootListController.h"]:::core
                TC6["mdlkRootListController.m"]:::core
            end
            TC_MAIN["Tweak Core Module"]:::core
        end

        subgraph "Themes Repository"
            TR_MAIN["Themes Repo"]:::theme
            TR1["iOS 11 Themes"]:::theme
            TR2["iOS 12 Themes"]:::theme
        end

        subgraph "Configuration / Preferences"
            CFG1["Info.plist"]:::config
            CFG2["latchkeyPrefsMain.plist"]:::config
            CFG3["LatchKey.plist"]:::config
            CFG4["entry.plist"]:::config
            CFG_MAIN["Resource Config"]:::config
        end

        SYS -->|"injects"| TC_MAIN
        CFG_MAIN -->|"configures"| TC_MAIN
        TC_MAIN -->|"loads"| TR_MAIN
        TR_MAIN -->|"contains"| TR1
        TR_MAIN -->|"contains"| TR2
    end

    subgraph "Build & Packaging Tools"
        BT1["Makefile (root)"]:::build
        BT2["Makefile (latchkey)"]:::build
        BT3["control file"]:::build
        BT_MAIN["Build Tools"]:::build
    end

    %% Click Events for Tweak Core Module
    click TC1 "https://github.com/mdausch/latchkey/blob/master/LatchKey.xm"
    click TC2 "https://github.com/mdausch/latchkey/blob/master/Latchkey.h"
    click TC_MAIN "https://github.com/mdausch/latchkey/tree/master/latchkey"
    click TC3 "https://github.com/mdausch/latchkey/blob/master/latchkey/mdFeedbackController.h"
    click TC4 "https://github.com/mdausch/latchkey/blob/master/latchkey/mdFeedbackController.m"
    click TC5 "https://github.com/mdausch/latchkey/blob/master/latchkey/mdlkRootListController.h"
    click TC6 "https://github.com/mdausch/latchkey/blob/master/latchkey/mdlkRootListController.m"

    %% Click Event for Themes Repository
    click TR_MAIN "https://github.com/mdausch/latchkey/tree/master/Layout/Library/Application Support/LatchKey/Themes"

    %% Click Events for Configuration / Preferences
    click CFG1 "https://github.com/mdausch/latchkey/blob/master/latchkey/Resources/Info.plist"
    click CFG2 "https://github.com/mdausch/latchkey/blob/master/latchkey/Resources/latchkeyPrefsMain.plist"
    click CFG3 "https://github.com/mdausch/latchkey/blob/master/LatchKey.plist"
    click CFG4 "https://github.com/mdausch/latchkey/blob/master/latchkey/entry.plist"

    %% Click Events for Build & Packaging Tools
    click BT1 "https://github.com/mdausch/latchkey/tree/master/Makefile"
    click BT2 "https://github.com/mdausch/latchkey/tree/master/latchkey/Makefile"
    click BT3 "https://github.com/mdausch/latchkey/tree/master/control"

    %% Styles
    classDef system fill:#FFCC00,stroke:#333,stroke-width:2px;
    classDef core fill:#A2D5F2,stroke:#333,stroke-width:2px;
    classDef theme fill:#B7E1CD,stroke:#333,stroke-width:2px;
    classDef config fill:#F7CAC9,stroke:#333,stroke-width:2px;
    classDef build fill:#FFE0B2,stroke:#333,stroke-width:2px;
```
