# shubham0812/swiftui-animations architecture

> Architecture diagram of the GitHub repository shubham0812/swiftui-animations, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shubham0812/swiftui-animations
- Repository: https://github.com/shubham0812/swiftui-animations

## Overview

#### Purpose and Runtime
This is an iOS 17+ SwiftUI showcase app and copyable component collection for interactive animations and Metal visual effects. It is built in Swift 5+ with Xcode; no backend, persistence layer, or external runtime service is indicated. The app target and build configuration are defined by `SwiftUI-Animations.xcodeproj/project.pbxproj`.

#### Application Entry and Composition
UIKit lifecycle adapters launch the SwiftUI application:
- `SwiftUI-Animations/Code/Controllers/AppDelegate.swift`
- `SwiftUI-Animations/Code/Controllers/SceneDelegate.swift`

The root SwiftUI shell is `SwiftUI-Animations/Code/Features/App/Views/RootView.swift`. It combines application coordination, navigation, and top-level presentation state from:
- `SwiftUI-Animations/Code/Features/App/Models/AppCoordinator.swift`
- `SwiftUI-Animations/Code/Features/App/Models/AppTab.swift`

#### Gallery Discovery Flow
The home feature presents the catalog of available animation demos. Animation metadata is represented by `SwiftUI-Animations/Code/Features/Home/Models/AnimationItem.swift`; `SwiftUI-Animations/Code/Features/Home/HomeView.swift` renders the gallery, and `SwiftUI-Animations/Code/Features/Home/Views/Support Views/AnimationCardView.swift` renders individual selectable cards.

User selection flows from a gallery card through the app’s navigation boundary in `SwiftUI-Animations/Code/Navigation/Router.swift`, then opens the corresponding standalone demo view.

#### Animation Component Boundary
Each reusable animation is intentionally self-contained under `SwiftUI-Animations/Code/Common/Animations`, generally separating its public/root view from state models, view models, and drawing support views. Representative stateful modules:
- Auto-scrolling wallet cards: `SwiftUI-Animations/Code/Common/Animations/Auto Scroller/ViewModels/AutoScrollerViewModel.swift`, `SwiftUI-Animations/Code/Common/Animations/Auto Scroller/Views/AutoScrollerView.swift`
- Card swapping: `SwiftUI-Animations/Code/Common/Animations/Cards Swap/ViewModels/CardSwapViewModel.swift`, `SwiftUI-Animations/Code/Common/Animations/Cards Swap/Views/CardSwapView.swift`
- Yin-yang toggle: `SwiftUI-Animations/Code/Common/Animations/YinYang-Toggle/ViewModels/YinYangViewModel.swift`, `SwiftUI-Animations/Code/Common/Animations/YinYang-Toggle/Views/YinYangAnimationView.swift`

Simple loaders and controls may consist of one root `View` plus custom SwiftUI `Shape` support files, allowing direct extraction without application-shell dependencies.

#### State, Interaction, and Device Feedback
Most demos own local SwiftUI animation/gesture state; selected complex components isolate mutable state in feature-local view models. The download-button flow explicitly models download behavior/state via:
- `SwiftUI-Animations/Code/Common/Animations/DownloadButton/Model/Downloader.swift`
- `SwiftUI-Animations/Code/Common/Animations/DownloadButton/DownloadButton.swift`

Device feedback is centralized behind `SwiftUI-Animations/Code/Services/HapticManager.swift`, keeping UIKit haptics separate from demo rendering.

#### GPU Shader Pipeline
Metal effects are paired at the feature boundary: a `.metal` kernel implements GPU pixel processing and a SwiftUI wrapper applies/exposes it. Examples:
- Burn: `SwiftUI-Animations/Code/Common/Shaders/Burn/BurnEffect.metal`, `SwiftUI-Animations/Code/Common/Shaders/Burn/BurnEffect.swift`
- Ripple: `SwiftUI-Animations/Code/Common/Shaders/RippleEffect/RippleEffect.metal`, `SwiftUI-Animations/Code/Common/Shaders/RippleEffect/RippleEffectView.swift`

The shader gallery uses `SwiftUI-Animations/Code/Features/Models/ShaderItem.swift` and `SwiftUI-Animations/Code/Features/Shaders/ShaderView.swift` to discover and present these effects separately from CPU-driven animations.

#### Resources and Delivery
Visual assets, launch screen, and bundled fonts are app resources:
- `SwiftUI-Animations/Resources/Assets.xcassets`
- `SwiftUI-Animations/Resources/Fonts/ClashGrotesk`
- `SwiftUI-Animations/Resources/Base.lproj/LaunchScreen.storyboard`

Shared styling/font access belongs in `SwiftUI-Animations/Code/Utils/Colors.swift` and `SwiftUI-Animations/Code/Utils/FontManager.swift`. GitHub Actions builds the iOS project through `.github/workflows/build.yml`.

Main entry points: [`SwiftUI-Animations/Code/Features/App/Views/RootView.swift`](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/App/Views/RootView.swift) (Root view), [`SwiftUI-Animations/Code/Common/Animations`](https://github.com/shubham0812/swiftui-animations/tree/master/SwiftUI-Animations/Code/Common/Animations) (Reusable animations), [`SwiftUI-Animations/Code/Features/Home/HomeView.swift`](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/Home/HomeView.swift) (Animation gallery), [`SwiftUI-Animations/Code/Features/Shaders/ShaderView.swift`](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/Shaders/ShaderView.swift) (Shader gallery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App shell"]
  node_lifecycle["UIKit lifecycle<br/>app delegates<br/>[AppDelegate.swift]"]
  node_scene["Scene delegate<br/>scene lifecycle"]
  node_root["Root view<br/>SwiftUI shell<br/>[RootView.swift]"]
  node_coordinator["App coordinator<br/>navigation state"]
  node_tabs["App tabs<br/>tab model<br/>[AppTab.swift]"]
  node_router["Router<br/>navigation boundary<br/>[Router.swift]"]
end

subgraph group_gallery["Discovery"]
  node_home["Animation gallery<br/>SwiftUI feature<br/>[HomeView.swift]"]
  node_animation_items["Animation catalog<br/>metadata model"]
  node_cards["Gallery cards<br/>selection view"]
end

subgraph group_animations["Animation components"]
  node_animation_components["Reusable animations<br/>component collection"]
  node_auto_scroller_state["Auto scroller state<br/>view model"]
  node_auto_scroller["Auto scroller<br/>animation view"]
  node_card_swap["Card swap<br/>stateful animation<br/>[CardSwapView.swift]"]
  node_download["Download button<br/>interactive component"]
end

subgraph group_shaders["Metal effects"]
  node_shader_gallery["Shader gallery<br/>SwiftUI feature<br/>[ShaderView.swift]"]
  node_shader_items["Shader catalog<br/>metadata model<br/>[ShaderItem.swift]"]
  node_ripple_wrapper["Ripple effect<br/>SwiftUI shader wrapper"]
  node_ripple_kernel["Ripple kernel<br/>Metal shader<br/>[RippleEffect.metal]"]
end

subgraph group_platform["Platform and delivery"]
  node_project["Xcode project<br/>build target<br/>[project.pbxproj]"]
  node_haptics["Haptic manager<br/>UIKit feedback service"]
  node_resources["App resources<br/>assets, fonts, launch screen<br/>[Assets.xcassets]"]
  node_build["CI build<br/>GitHub Actions workflow<br/>[build.yml]"]
end

node_project -->|"builds"| node_lifecycle
node_project -->|"bundles"| node_resources
node_build -->|"builds"| node_project
node_lifecycle -->|"creates"| node_scene
node_scene -->|"hosts"| node_root
node_root -->|"uses"| node_coordinator
node_root -->|"renders"| node_tabs
node_root -->|"presents"| node_home
node_root -->|"presents"| node_shader_gallery
node_home -->|"reads"| node_animation_items
node_home -->|"renders"| node_cards
node_cards -->|"selects via"| node_router
node_router -->|"opens"| node_animation_components
node_auto_scroller_state -->|"drives"| node_auto_scroller
node_animation_components -->|"includes"| node_auto_scroller
node_animation_components -->|"includes"| node_card_swap
node_animation_components -->|"includes"| node_download
node_download -.->|"triggers"| node_haptics
node_shader_gallery -->|"reads"| node_shader_items
node_shader_gallery -->|"presents"| node_ripple_wrapper
node_ripple_wrapper -->|"applies"| node_ripple_kernel

click node_project "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations.xcodeproj/project.pbxproj"
click node_lifecycle "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Controllers/AppDelegate.swift"
click node_scene "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Controllers/SceneDelegate.swift"
click node_root "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/App/Views/RootView.swift"
click node_coordinator "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/App/Models/AppCoordinator.swift"
click node_tabs "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/App/Models/AppTab.swift"
click node_home "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/Home/HomeView.swift"
click node_animation_items "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/Home/Models/AnimationItem.swift"
click node_cards "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/Home/Views/Support Views/AnimationCardView.swift"
click node_router "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Navigation/Router.swift"
click node_animation_components "https://github.com/shubham0812/swiftui-animations/tree/master/SwiftUI-Animations/Code/Common/Animations"
click node_auto_scroller_state "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Common/Animations/Auto Scroller/ViewModels/AutoScrollerViewModel.swift"
click node_auto_scroller "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Common/Animations/Auto Scroller/Views/AutoScrollerView.swift"
click node_card_swap "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Common/Animations/Cards Swap/Views/CardSwapView.swift"
click node_download "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Common/Animations/DownloadButton/DownloadButton.swift"
click node_haptics "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Services/HapticManager.swift"
click node_shader_gallery "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/Shaders/ShaderView.swift"
click node_shader_items "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/Models/ShaderItem.swift"
click node_ripple_wrapper "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Common/Shaders/RippleEffect/RippleEffectView.swift"
click node_ripple_kernel "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Common/Shaders/RippleEffect/RippleEffect.metal"
click node_resources "https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Resources/Assets.xcassets"
click node_build "https://github.com/shubham0812/swiftui-animations/blob/master/.github/workflows/build.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_lifecycle,node_scene,node_root,node_coordinator,node_tabs,node_router toneBlue
class node_home,node_animation_items,node_cards toneAmber
class node_animation_components,node_auto_scroller_state,node_auto_scroller,node_card_swap,node_download toneMint
class node_shader_gallery,node_shader_items,node_ripple_wrapper,node_ripple_kernel toneRose
class node_project,node_haptics,node_resources,node_build toneIndigo
```

## Components

### App shell

- [UIKit lifecycle](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Controllers/AppDelegate.swift): app delegates · Launches the SwiftUI application. · `SwiftUI-Animations/Code/Controllers/AppDelegate.swift`
- [Scene delegate](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Controllers/SceneDelegate.swift): scene lifecycle · `SwiftUI-Animations/Code/Controllers/SceneDelegate.swift`
- [Root view](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/App/Views/RootView.swift): SwiftUI shell · Hosts top-level navigation and presentation. · `SwiftUI-Animations/Code/Features/App/Views/RootView.swift`
- [App coordinator](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/App/Models/AppCoordinator.swift): navigation state · `SwiftUI-Animations/Code/Features/App/Models/AppCoordinator.swift`
- [App tabs](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/App/Models/AppTab.swift): tab model · `SwiftUI-Animations/Code/Features/App/Models/AppTab.swift`
- [Router](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Navigation/Router.swift): navigation boundary · Maps gallery selections to standalone demos. · `SwiftUI-Animations/Code/Navigation/Router.swift`

### Discovery

- [Animation gallery](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/Home/HomeView.swift): SwiftUI feature · `SwiftUI-Animations/Code/Features/Home/HomeView.swift`
- [Animation catalog](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/Home/Models/AnimationItem.swift): metadata model · `SwiftUI-Animations/Code/Features/Home/Models/AnimationItem.swift`
- [Gallery cards](https://github.com/shubham0812/swiftui-animations/blob/HEAD/SwiftUI-Animations/Code/Features/Home/Views/Support%20Views/AnimationCardView.swift): selection view · `SwiftUI-Animations/Code/Features/Home/Views/Support Views/AnimationCardView.swift`

### Animation components

Self-contained reusable SwiftUI demos.

- [Reusable animations](https://github.com/shubham0812/swiftui-animations/tree/master/SwiftUI-Animations/Code/Common/Animations): component collection · Extractable SwiftUI animations with local state and drawing support. · `SwiftUI-Animations/Code/Common/Animations`
- [Auto scroller state](https://github.com/shubham0812/swiftui-animations/blob/HEAD/SwiftUI-Animations/Code/Common/Animations/Auto%20Scroller/ViewModels/AutoScrollerViewModel.swift): view model · `SwiftUI-Animations/Code/Common/Animations/Auto Scroller/ViewModels/AutoScrollerViewModel.swift`
- [Auto scroller](https://github.com/shubham0812/swiftui-animations/blob/HEAD/SwiftUI-Animations/Code/Common/Animations/Auto%20Scroller/Views/AutoScrollerView.swift): animation view · `SwiftUI-Animations/Code/Common/Animations/Auto Scroller/Views/AutoScrollerView.swift`
- [Card swap](https://github.com/shubham0812/swiftui-animations/blob/HEAD/SwiftUI-Animations/Code/Common/Animations/Cards%20Swap/Views/CardSwapView.swift): stateful animation · `SwiftUI-Animations/Code/Common/Animations/Cards Swap/Views/CardSwapView.swift`
- [Download button](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Common/Animations/DownloadButton/DownloadButton.swift): interactive component · `SwiftUI-Animations/Code/Common/Animations/DownloadButton/DownloadButton.swift`

### Metal effects

- [Shader gallery](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/Shaders/ShaderView.swift): SwiftUI feature · `SwiftUI-Animations/Code/Features/Shaders/ShaderView.swift`
- [Shader catalog](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Features/Models/ShaderItem.swift): metadata model · `SwiftUI-Animations/Code/Features/Models/ShaderItem.swift`
- [Ripple effect](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Common/Shaders/RippleEffect/RippleEffectView.swift): SwiftUI shader wrapper · `SwiftUI-Animations/Code/Common/Shaders/RippleEffect/RippleEffectView.swift`
- [Ripple kernel](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Common/Shaders/RippleEffect/RippleEffect.metal): Metal shader · GPU pixel-processing implementation. · `SwiftUI-Animations/Code/Common/Shaders/RippleEffect/RippleEffect.metal`

### Platform and delivery

- [Xcode project](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations.xcodeproj/project.pbxproj): build target · `SwiftUI-Animations.xcodeproj/project.pbxproj`
- [Haptic manager](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Code/Services/HapticManager.swift): UIKit feedback service · `SwiftUI-Animations/Code/Services/HapticManager.swift`
- [App resources](https://github.com/shubham0812/swiftui-animations/blob/master/SwiftUI-Animations/Resources/Assets.xcassets): assets, fonts, launch screen · `SwiftUI-Animations/Resources/Assets.xcassets`
- [CI build](https://github.com/shubham0812/swiftui-animations/blob/master/.github/workflows/build.yml): GitHub Actions workflow · `.github/workflows/build.yml`

## Connections

- Xcode project → UIKit lifecycle: builds
- Xcode project → App resources: bundles
- CI build → Xcode project: builds
- UIKit lifecycle → Scene delegate: creates
- Scene delegate → Root view: hosts
- Root view → App coordinator: uses
- Root view → App tabs: renders
- Root view → Animation gallery: presents
- Root view → Shader gallery: presents
- Animation gallery → Animation catalog: reads
- Animation gallery → Gallery cards: renders
- Gallery cards → Router: selects via
- Router → Reusable animations: opens
- Auto scroller state → Auto scroller: drives
- Reusable animations → Auto scroller: includes
- Reusable animations → Card swap: includes
- Reusable animations → Download button: includes
- Download button → Haptic manager: triggers
- Shader gallery → Shader catalog: reads
- Shader gallery → Ripple effect: presents
- Ripple effect → Ripple kernel: applies
