# iplayground/iplayground-app-2025 architecture

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

- Interactive diagram: https://gitdiagram.com/iplayground/iplayground-app-2025
- Repository: https://github.com/iplayground/iplayground-app-2025

## Overview

##### Project type and purpose
- This is a modular Swift Package template for building SwiftUI apps (iOS & macOS) using The Composable Architecture (TCA).
- It cleanly separates concerns into SPM modules—Models, Features (reducers + tests), Views, DependencyClients, DependencyClientsLive—and a PublicApp “shell” that ties everything together.
- There's also an Xcode app target and a Today-style widget (NowWidget) that reuse the same package modules.

A. External Dependencies
- TCA (pointfreeco/swift-composable-architecture)
- Any other third-party SPM libraries (“Others”)
B. Local Swift Package Modules
1. Models
2. DependencyClients (protocols) → DependencyClientsLive (concrete)
3. Features (TCA reducers + state + actions) → FeaturesTests
4. Views (SwiftUI)
5. PublicApp (application entry point)
C. Xcode Targets
- iOS App (imports PublicApp)
- NowWidget Extension (imports PublicApp + WidgetClient)

##### Relationships & data flow
- Models → Features, Views, DependencyClients
- TCA → Features, Views (stores, reducers, scoped state)
- DependencyClients → Features (injected into environments)
- DependencyClientsLive → PublicApp & NowWidget (runtime DI)
- Features → FeaturesTests (unit-test target)
- Features + Views + DependencyClientsLive → PublicApp → iOS App & NowWidget

##### Architectural patterns & principles
- The Composable Architecture: each feature is a standalone reducer with scoped state, actions, and environment.
- Protocol-based DI: clients define protocols in DependencyClients; live implementations reside in DependencyClientsLive.
- Modular SPM layout: compile-time boundaries encourage independent development & TDD.
- SwiftUI previews: Views module used to iterate UI without rebuilding the full app.

##### Relevant technologies & frameworks
- Swift Package Manager (modular SPM targets)
- SwiftUI (all UI components)
- TCA (state management)
- XCTest (FeaturesTests, ModelsTests)
- Xcode project for app targets & widget extension

## Diagram (Mermaid)

```mermaid
flowchart TD
  subgraph "External Dependencies"
    TCA["TCA<br/>(swift-composable-architecture)"]:::external
    Others["Others"]:::external
  end

  subgraph "Local Swift Package"
    Models["Models"]:::local
    DependencyClients{"DependencyClients"}:::local
    DependencyClientsLive["DependencyClientsLive"]:::local
    Features["Features<br/>(Reducers & State)"]:::local
    FeaturesTests["FeaturesTests"]:::local
    Views(("Views")):::local
    PublicApp["PublicApp"]:::local
  end

  subgraph "Xcode Targets"
    iOSApp["iOS App"]:::app
    NowWidget["NowWidget"]:::app
  end

  Models --> Features
  Models --> Views
  Models --> DependencyClients
  TCA --> Features
  TCA --> Views
  DependencyClients --> Features
  DependencyClientsLive --> PublicApp
  DependencyClientsLive --> NowWidget
  Features --> FeaturesTests
  Features --> PublicApp
  Views --> PublicApp
  DependencyClientsLive --> PublicApp
  PublicApp --> iOSApp
  PublicApp --> NowWidget
  NowWidget --> DependencyClients

  click Models "https://github.com/iplayground/iplayground-app-2025/tree/main/Sources/Models"
  click DependencyClients "https://github.com/iplayground/iplayground-app-2025/tree/main/Sources/DependencyClients"
  click DependencyClientsLive "https://github.com/iplayground/iplayground-app-2025/tree/main/Sources/DependencyClientsLive"
  click Features "https://github.com/iplayground/iplayground-app-2025/tree/main/Sources/Features"
  click FeaturesTests "https://github.com/iplayground/iplayground-app-2025/tree/main/Tests/FeaturesTests"
  click Views "https://github.com/iplayground/iplayground-app-2025/tree/main/Sources/Views"
  click PublicApp "https://github.com/iplayground/iplayground-app-2025/blob/main/Sources/PublicApp/PublicApp.swift"
  click iOSApp "https://github.com/iplayground/iplayground-app-2025/tree/main/iPlayground/iPlayground"
  click NowWidget "https://github.com/iplayground/iplayground-app-2025/tree/main/iPlayground/NowWidget"
  click TCA "https://github.com/iplayground/iplayground-app-2025/blob/main/Package.swift"
  click Others "https://github.com/iplayground/iplayground-app-2025/blob/main/Package.swift"

  classDef external fill:#cccccc,stroke:#333,stroke-width:1px;
  classDef local fill:#bbddff,stroke:#333,stroke-width:1px;
  classDef app fill:#ccffcc,stroke:#333,stroke-width:1px;
```
