# nimblehq/ios-templates architecture

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

- Interactive diagram: https://gitdiagram.com/nimblehq/ios-templates
- Repository: https://github.com/nimblehq/ios-templates

## Overview

Based on our analysis of the file tree and README, this project is an iOS template repository used to quickly bootstrap new iOS applications. It leverages multiple tools and frameworks such as Swift (for iOS development), Tuist (for project description and creation), Fastlane (for automation of builds, tests, and deployments), and CI/CD configurations via GitHub workflows and other deployment scripts. The project is well modularized into components like "Modules" (for core application logic split into Data and Domain), "Scripts" (which host the iOSTemplateMaker tool), and dedicated directories for both SwiftUI and UIKit projects under the Tuist/Interfaces hierarchy. There is also heavy emphasis on testing and automation (given the Tests and CI workflows).

##### Main Components
- Template Engine & CLI: Represent the “Scripts/Swift/iOSTemplateMaker” which is used to generate new iOS projects.
- Application Building Blocks (Modules):
– Data Module: Contains network API components, repositories, models, request configurations, and associated tests.
– Domain Module: Hosts core business logic like entities, interfaces, and use cases together with its own tests.
- User Interface Implementations:
– Tuist/Interfaces – broken into SwiftUI and UIKit. These directories include project configurations, source code, and supporting assets.
- Automation & CI/CD:
– Fastlane directory: Contains building, archive, testing routines with helper files, configuration constants, and plugins.
– GitHub workflows (.github/workflows, .github/project_workflows, and self_hosted workflows) and configuration files for CI/CD (bitrise, codemagic, etc.)
- Project Configuration & Resources:
– {PROJECT_NAME} and its nested directories (Configurations, Resources, Sources, and tests) demonstrate how the generated projects are structured.
- Dependency and Build Tools:
– Tuist configuration files (Workspace.swift, Project.swift, etc.) and package management files (GitHub, Gemfile, .swift-version, etc.)

##### Relationships and Interactions
- The iOSTemplateMaker (CLI tool) triggers project generation by processing template files and configuration.
- Generated projects then use Modules (Data and Domain) as layers: Domain orchestrates business logic and relies on Data for network/API communication.
- The UI layer is distinct with parallel implementations for SwiftUI and UIKit, ensuring design flexibility.
- Fastlane scripts and CI workflows automate testing, building, releasing, and deployment processes, and integrate with deployment services (Firebase, App Store, TestFlight).
- Tuist configurations coordinate the overall project structure and ensure that all generated modules and resources are correctly integrated.

##### Architectural Patterns & Design Principles
- Modularity: Separation between Data, Domain, and Presentation (UI) layers.
- Template-driven Generation: Use of CLI tools and templating (with sources like the iOSTemplateMaker and Sourcery templates) to enforce consistency.
- Automated CI/CD: Integration with multiple automation tools demonstrates continuous integration/delivery practices.
- Multi-Interface Support: Clear separation between SwiftUI and UIKit implementations.
- Clear Separation of Build/Configuration Artifacts: Directories for configurations, resources, and tests that further separate concerns.

##### Diagraming Elements
- Clear Labels:
– “iOSTemplateMaker CLI” for the template engine.
– “Modules/Data”, “Modules/Domain” for core logic.
– “Tuist/Interfaces (SwiftUI)” and “Tuist/Interfaces (UIKit)” for UI implementations.
– “Fastlane” and “CI/CD Workflows (GitHub, Bitrise, Codemagic)” for automation.
– “Project Configurations & Resources ({PROJECT_NAME})” representing the generated project structure.
– From the CLI (iOSTemplateMaker) to the generated project structure.
– From Modules to UI layers (showing dependency on business logic for UI rendering).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Level: Template Generation
    CLI["iOSTemplateMaker CLI"]:::cli
    CONFIG["Project Configurations & Resources ({PROJECT_NAME})"]:::build

    CLI -->|"generates"| CONFIG

    %% Generated Project Structure: Modules and UI Layers
    subgraph "Application Building Blocks"
        DATA["Modules/Data"]:::module
        DOMAIN["Modules/Domain"]:::module
        DOMAIN -->|"dependsOn"| DATA
    end

    subgraph "User Interface Implementations"
        SWIFTUI["Tuist/Interfaces (SwiftUI)"]:::ui
        UIKIT["Tuist/Interfaces (UIKit)"]:::ui
    end

    %% Dependency and Build Tools
    subgraph "Dependency & Build Tools"
        PROJ["Project.swift"]:::build
        WORKSPACE["Workspace.swift"]:::build
        GEMFILE["Gemfile"]:::build
        SWIFTVER[".swift-version"]:::build
        TUISTVER[".tuist-version"]:::build
    end

    %% Automation & CI/CD Layer
    subgraph "Automation & CI/CD"
        FASTLANE["Fastlane"]:::automation
        subgraph "CI/CD Workflows"
            GITHUB["GitHub Workflows (.github/workflows)"]:::automation
            PROJECT_WORK["Project Workflows (.github/project_workflows)"]:::automation
            SELF_HOST["Self Hosted Workflows (.github/self_hosted_project_workflows)"]:::automation
        end
    end

    %% Deployment node
    DEPLOY["Deploy: AppStore, Firebase, TestFlight"]:::deploy

    %% Connections between Generated Project and Components
    CONFIG -->|"includes"| DATA
    CONFIG -->|"includes"| DOMAIN
    CONFIG -->|"includes"| SWIFTUI
    CONFIG -->|"includes"| UIKIT
    CONFIG -->|"integrates"| PROJ
    CONFIG -->|"integrates"| WORKSPACE
    CONFIG -->|"integrates"| GEMFILE
    CONFIG -->|"integrates"| SWIFTVER
    CONFIG -->|"integrates"| TUISTVER

    %% Modules to UI connections indicating business logic usage
    DOMAIN -->|"supports"| SWIFTUI
    DOMAIN -->|"supports"| UIKIT

    %% Automation connections
    CONFIG -->|"triggers"| FASTLANE
    CONFIG -->|"triggers"| GITHUB
    CONFIG -->|"triggers"| PROJECT_WORK
    CONFIG -->|"triggers"| SELF_HOST

    FASTLANE -->|"automates"| DEPLOY
    GITHUB -->|"automates"| DEPLOY
    PROJECT_WORK -->|"automates"| DEPLOY
    SELF_HOST -->|"automates"| DEPLOY

    %% Styles
    classDef cli fill:#F9D6A5,stroke:#B5651D,stroke-width:2px;
    classDef module fill:#CCE5FF,stroke:#004085,stroke-width:2px;
    classDef ui fill:#D4EDDA,stroke:#155724,stroke-width:2px;
    classDef automation fill:#FFF3CD,stroke:#856404,stroke-width:2px;
    classDef build fill:#D1ECF1,stroke:#0C5460,stroke-width:2px;
    classDef deploy fill:#C3E6CB,stroke:#155724,stroke-width:2px;

    %% Click Events
    click CLI "https://github.com/nimblehq/ios-templates/tree/main/Scripts/Swift/iOSTemplateMaker"
    click DATA "https://github.com/nimblehq/ios-templates/tree/main/Modules/Data"
    click DOMAIN "https://github.com/nimblehq/ios-templates/tree/main/Modules/Domain"
    click SWIFTUI "https://github.com/nimblehq/ios-templates/tree/main/Tuist/Interfaces/SwiftUI"
    click UIKIT "https://github.com/nimblehq/ios-templates/tree/main/Tuist/Interfaces/UIKit"
    click FASTLANE "https://github.com/nimblehq/ios-templates/tree/main/fastlane"
    click GITHUB "https://github.com/nimblehq/ios-templates/tree/main/.github/workflows"
    click PROJECT_WORK "https://github.com/nimblehq/ios-templates/tree/main/.github/project_workflows"
    click SELF_HOST "https://github.com/nimblehq/ios-templates/tree/main/.github/self_hosted_project_workflows"
    click CONFIG "https://github.com/nimblehq/ios-templates/tree/main/{PROJECT_NAME}"
    click PROJ "https://github.com/nimblehq/ios-templates/blob/main/Project.swift"
    click WORKSPACE "https://github.com/nimblehq/ios-templates/blob/main/Workspace.swift"
    click GEMFILE "https://github.com/nimblehq/ios-templates/tree/main/Gemfile"
    click SWIFTVER "https://github.com/nimblehq/ios-templates/blob/main/.swift-version"
    click TUISTVER "https://github.com/nimblehq/ios-templates/blob/main/.tuist-version"
```
