# texturegroup/texture architecture

> Architecture diagram of the GitHub repository texturegroup/texture, 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/texturegroup/texture
- Repository: https://github.com/texturegroup/texture

## Overview

##### Project Type and Purpose
- This is an open-source UI framework (“Texture”, formerly AsyncDisplayKit) for iOS/tvOS, written primarily in Objective-C (with Swift interop).
- It provides a node-based abstraction (ASDisplayNode) over UIView/CALayer to move layout, drawing, and image/text processing off the main thread, boosting rendering performance.

##### File Structure Analysis
- Top-level: AsyncDisplayKit.xcodeproj, Podspecs (Texture.podspec), Cartfile, build scripts (CI/build.sh, build.sh).
- Source/: public API headers & implementations (ASDisplayNode, ASButtonNode, ASCollectionNode, ASLayoutSpec, etc).
- Source/Base, Source/Details, Source/Layout, Source/TextKit: core submodules (assertions/logging, layout engine, detailed controllers, text rendering).
- Source/Private: internal helpers, caches, private categories.
- Tests/: unit & snapshot tests validating modules.
- examples/: sample apps demonstrating use-cases.
- docs/: user guides and generated AppleDoc HTML.

##### README Insights
- Installs via CocoaPods/Carthage.
- Emphasizes off-main-thread node rendering, layout specs, async transactions.
- Highlights core abstractions: ASDisplayNode, transaction system, layout specs, image/text nodes.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Public API Layer
    subgraph "Public API Layer"
        direction TB
        APIDisplayNode["ASDisplayNode"]:::public
        APIButtonNode["ASButtonNode"]:::public
        APICollectionNode["ASCollectionNode"]:::public
        APILayoutSpec["ASLayoutSpec"]:::public
        APITextNode["ASTextNode"]:::public
        APINetworkImageNode["ASNetworkImageNode"]:::public
    end

    %% Core Engines
    subgraph "Core Engines"
        direction TB
        subgraph "Transaction System"
            direction TB
            TransAction["_ASAsyncTransaction"]:::core
            TransGroup["_ASAsyncTransactionGroup"]:::core
            TransContainer["_ASAsyncTransactionContainer"]:::core
        end
        subgraph "Layout Engine"
            direction TB
            LayoutController["ASLayoutController"]:::core
            RangeController["ASRangeController"]:::core
            LayoutSpecCore["ASLayoutSpec (Core)"]:::core
            Dimension["ASDimension"]:::core
            StackSpec["ASStackLayoutSpec"]:::core
            YogaUtils["ASYogaUtilities"]:::core
        end
    end

    %% Rendering Bridge
    subgraph "Rendering Bridge"
        direction TB
        DisplayLayer["_ASDisplayLayer"]:::render
        DisplayView["_ASDisplayView"]:::render
        ViewAccess["_ASDisplayViewAccessibility"]:::render
    end

    %% Background Services
    subgraph "Background Services"
        direction TB
        ImageDownloader["ASBasicImageDownloader"]:::background
        PINDownloader["ASPINRemoteImageDownloader"]:::background
        ImageNode["ASImageNode"]:::background
        NetworkImageNode["ASNetworkImageNode"]:::background
        TextRenderer["ASTextKitRenderer"]:::background
        LayoutManager["ASLayoutManager"]:::background
        TextAdditions["ASTextKitCoreTextAdditions"]:::background
    end

    %% Configuration & Debug
    subgraph "Configuration & Debug"
        direction TB
        Config["ASConfiguration"]:::private
        Experimental["ASExperimentalFeatures"]:::private
        DebugCat["AsyncDisplayKit+Debug"]:::private
    end

    %% Internal Helpers
    subgraph "Internal Helpers"
        direction TB
        InternalHelpers["ASInternalHelpers"]:::private
        Locking["ASLocking"]:::private
        FrameworkPrivate["ASDisplayNode+FrameworkPrivate"]:::private
    end

    %% Clients & Build/Test
    subgraph "Clients & Build/Test"
        direction TB
        Examples["examples/"]:::external
        BuildScripts["CI/build.sh, build.sh"]:::external
        Tests["Tests/"]:::external
    end

    %% Data Flow
    APIDisplayNode -->|"enqueue ops"| TransAction
    APIButtonNode --> TransAction
    APICollectionNode --> TransAction
    APILayoutSpec --> LayoutController
    TransAction -->|"batch updates"| TransGroup
    TransGroup --> TransContainer
    TransContainer --> LayoutController
    LayoutController -->|"compute layout"| LayoutSpecCore
    LayoutSpecCore --> Dimension
    LayoutSpecCore --> StackSpec
    StackSpec --> YogaUtils
    LayoutController --> DisplayLayer
    DisplayLayer --> DisplayView
    DisplayView --> ViewAccess
    APITextNode --> TextRenderer
    TextRenderer --> LayoutManager
    LayoutManager --> TextAdditions
    APINetworkImageNode --> PINDownloader
    PINDownloader --> ImageDownloader
    ImageDownloader --> ImageNode
    ImageNode --> TransContainer
    Config --> APIDisplayNode
    Experimental --> APIDisplayNode
    DebugCat --> APIDisplayNode
    InternalHelpers --> TransAction
    InternalHelpers --> LayoutController
    Locking --> TransAction
    FrameworkPrivate --> APIDisplayNode
    Examples --> APIDisplayNode
    BuildScripts --> Tests
    Tests --> APIDisplayNode

    %% Legend
    subgraph "Legend"
        direction TB
        Public["Public API Layer"]:::public
        Core["Core Engines"]:::core
        Render["Rendering Bridge"]:::render
        Background["Background Services"]:::background
        Private["Config & Internal"]:::private
        External["Clients & Build/Test"]:::external
    end

    %% Click Events
    click APIDisplayNode "https://github.com/texturegroup/texture/blob/master/Source/ASDisplayNode.h"
    click APIButtonNode "https://github.com/texturegroup/texture/blob/master/Source/ASButtonNode.h"
    click APICollectionNode "https://github.com/texturegroup/texture/blob/master/Source/ASCollectionNode.h"
    click APILayoutSpec "https://github.com/texturegroup/texture/blob/master/Source/ASLayoutSpec.h"
    click APITextNode "https://github.com/texturegroup/texture/blob/master/Source/ASTextNode.h"
    click APINetworkImageNode "https://github.com/texturegroup/texture/blob/master/Source/ASNetworkImageNode.h"
    click LayoutController "https://github.com/texturegroup/texture/blob/master/Source/Details/ASLayoutController.h"
    click RangeController "https://github.com/texturegroup/texture/blob/master/Source/Details/ASRangeController.h"
    click LayoutSpecCore "https://github.com/texturegroup/texture/blob/master/Source/Layout/ASLayoutSpec.h"
    click Dimension "https://github.com/texturegroup/texture/blob/master/Source/Layout/ASDimension.h"
    click StackSpec "https://github.com/texturegroup/texture/blob/master/Source/Layout/ASStackLayoutSpec.h"
    click YogaUtils "https://github.com/texturegroup/texture/blob/master/Source/Layout/ASYogaUtilities.h"
    click TransAction "https://github.com/texturegroup/texture/blob/master/Source/Details/Transactions/_ASAsyncTransaction.h"
    click TransGroup "https://github.com/texturegroup/texture/blob/master/Source/Details/Transactions/_ASAsyncTransactionGroup.h"
    click TransContainer "https://github.com/texturegroup/texture/blob/master/Source/Details/Transactions/_ASAsyncTransactionContainer.h"
    click DisplayLayer "https://github.com/texturegroup/texture/blob/master/Source/Details/_ASDisplayLayer.h"
    click DisplayView "https://github.com/texturegroup/texture/blob/master/Source/Details/_ASDisplayView.h"
    click ViewAccess "https://github.com/texturegroup/texture/blob/master/Source/Details/_ASDisplayViewAccessiblity.h"
    click ImageDownloader "https://github.com/texturegroup/texture/blob/master/Source/Details/ASBasicImageDownloader.h"
    click PINDownloader "https://github.com/texturegroup/texture/blob/master/Source/Details/ASPINRemoteImageDownloader.h"
    click ImageNode "https://github.com/texturegroup/texture/blob/master/Source/ASImageNode.h"
    click NetworkImageNode "https://github.com/texturegroup/texture/blob/master/Source/ASNetworkImageNode.h"
    click TextRenderer "https://github.com/texturegroup/texture/blob/master/Source/TextKit/ASTextKitRenderer.h"
    click LayoutManager "https://github.com/texturegroup/texture/blob/master/Source/TextKit/ASLayoutManager.h"
    click TextAdditions "https://github.com/texturegroup/texture/blob/master/Source/TextKit/ASTextKitCoreTextAdditions.h"
    click Config "https://github.com/texturegroup/texture/blob/master/Source/ASConfiguration.h"
    click Experimental "https://github.com/texturegroup/texture/blob/master/Source/ASExperimentalFeatures.h"
    click DebugCat "https://github.com/texturegroup/texture/blob/master/Source/Debug/AsyncDisplayKit+Debug.h"
    click InternalHelpers "https://github.com/texturegroup/texture/blob/master/Source/Private/ASInternalHelpers.h"
    click Locking "https://github.com/texturegroup/texture/blob/master/Source/Private/ASLocking.h"
    click FrameworkPrivate "https://github.com/texturegroup/texture/blob/master/Source/Private/ASDisplayNode+FrameworkPrivate.h"
    click Examples "https://github.com/texturegroup/texture/tree/master/examples/"
    click BuildScripts "https://github.com/texturegroup/texture/blob/master/CI/build.sh"
    click Tests "https://github.com/texturegroup/texture/tree/master/Tests/"

    %% Styles
    classDef public fill:#cbe4f9,stroke:#0366d6,color:#0366d6
    classDef core fill:#d2f8d2,stroke:#1a7f1a,color:#1a7f1a
    classDef render fill:#ffe5b4,stroke:#d97706,color:#d97706
    classDef background fill:#f3e5ff,stroke:#6b21a8,color:#6b21a8
    classDef private fill:#e2e8f0,stroke:#64748b,color:#64748b
    classDef external fill:#f8fafc,stroke:#94a3b8,color:#94a3b8
```
