# ozontech/suinavigation architecture

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

- Interactive diagram: https://gitdiagram.com/ozontech/suinavigation
- Repository: https://github.com/ozontech/suinavigation

## Overview

##### Main Components
- Public API/Modifiers Layer: Show the range of view modifiers (both for standard navigation and URL-based deep linking) that developers will use in their SwiftUI views.
- Test Framework: Illustrate the separate SUINavigationTest module used for unit and snapshot tests. Emphasize its role in testing navigation flows without relying on the app’s structural navigation.
- Example Applications: Represent the several example projects (like NavigationExample, MVVM+Coordinator, MVVM+Router, Simple, and NavigationFromTab) that demonstrate integration with different patterns (such as routing, Coordinator, or MVVM architecture). These examples show how the library is applied.
- Supporting Scripts & Documentation: Even though not part of runtime architecture, include a “Supporting Tools” block for build scripts (in Scripts folder), documentation (Docs folder), and package metadata (Package.swift). These help manage releases and integration.

##### Relationships and Interactions
- The core library (under Sources/SUINavigation) sits at the heart of the framework and provides public APIs (such as NavigationStorageView and related modifiers) to be consumed by client applications.
- The test framework (Sources/SUINavigationTest) interacts with the core by “hooking” into its navigation actions to simulate and capture transitions, unit testing deep link handling, and snapshot verification.
- The Example projects integrate the SUINavigation framework to demonstrate different navigation patterns. They may depend on the core module and sometimes link to the test package (for instance, NavigationExample includes tests).
- APIs like deep link support and Coordinator pattern-specific functions form the connective tissue between the core and its consumers, showing that the design relies on modularity and a declarative style with dependency injection (e.g., using EnvironmentObjects).

##### Important Architectural Patterns & Design Principles
- Separation of Concerns: The core functionalities are clearly delineated between navigation control (core logic), UI view modifiers (which are applied by developers), and testing mechanisms.
- Modularity & Extensibility: The split between SUINavigation and SUINavigationTest, as well as multiple sample projects, demonstrates the framework’s modular design. Identify each distinct module/component.
- Declarative UI Integration: Illustrate that the library is built on SwiftUI’s declarative approach by providing navigation view wrappers (NavigationStorageView) and modifiers, making the component reusable and extensible.
- Support for Multiple Navigation Paradigms: Emphasize that examples using MVVM+Coordinator and MVVM+Router show how the same navigation logic adapts to different architectural patterns.

##### Technology and Integration Details
- Swift Package Manager: Note that the project is distributed via SPM (Package.swift), and that the target relationship differentiates application code from test code.
- iOS Version Handling: Since the library provides compatibility fixes for older SwiftUI APIs and iOS versions (especially iOS 14.x through 18), annotate that the Navigation component is designed to abstract and handle native differences.
- Deep Link Handling: Highlight that the deep link support (through URL parsing and modification) is a primary feature—include a component or middleware block that shows the transformation of URL strings into navigation state.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "SUINavigation Library Core"
        Core("Core") 
        Common("Common") 
        DeepLink("Deep Link Handling")
    end

    subgraph "Public API/Modifiers Layer"
        API("Modifiers & API")
    end

    subgraph "Consumers"
        Examples("Example Applications")
        Tests("SUINavigationTest Framework")
    end

    subgraph "Supporting Tools"
        Docs("Documentation")
        Scripts("Scripts")
        Package("Package.swift")
    end

    %% Relationships
    API -->|"wraps"| Core
    API -->|"wraps"| Common
    DeepLink -->|"exposed_via"| API

    Examples -->|"uses_API"| API
    Examples -->|"depends_on"| Core
    Examples -->|"depends_on"| Common

    Tests -->|"hooks_into"| Core
    Tests -->|"consumes"| API

    Docs -.->|"supports"| Core
    Scripts -.->|"supports"| Core
    Package -.->|"defines"| Core

    %% Click Events
    click Core "https://github.com/ozontech/suinavigation/tree/main/Sources/SUINavigation/Core"
    click Common "https://github.com/ozontech/suinavigation/tree/main/Sources/SUINavigation/Common"
    click API "https://github.com/ozontech/suinavigation/tree/main/Sources/SUINavigation/Modifiers"
    click Tests "https://github.com/ozontech/suinavigation/tree/main/Sources/SUINavigationTest"
    click Examples "https://github.com/ozontech/suinavigation/tree/main/Example"
    click Docs "https://github.com/ozontech/suinavigation/tree/main/Docs"
    click Scripts "https://github.com/ozontech/suinavigation/tree/main/Scripts"
    click Package "https://github.com/ozontech/suinavigation/blob/main/Package.swift"

    %% Styles
    classDef core fill:#FFCCCC,stroke:#000,stroke-width:2px;
    classDef api fill:#CCFFCC,stroke:#000,stroke-width:2px;
    classDef consumer fill:#CCCCFF,stroke:#000,stroke-width:2px;
    classDef tools fill:#FFFFCC,stroke:#000,stroke-width:2px;
    
    class Core,Common,DeepLink core;
    class API api;
    class Examples,Tests consumer;
    class Docs,Scripts,Package tools;
```
