How ozontech/suinavigation works
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.