How shubham0812/swiftui-animations works
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: RootView.swift Root view · Animations Reusable animations · HomeView.swift Animation gallery · ShaderView.swift Shader gallery
Components 22
App shell
- UIKit lifecycle · Launches the SwiftUI application.
SwiftUI-Animations/Code/Controllers/AppDelegate.swift - Scene delegate
SwiftUI-Animations/Code/Controllers/SceneDelegate.swift - Root view · Hosts top-level navigation and presentation.
SwiftUI-Animations/Code/Features/App/Views/RootView.swift - App coordinator
SwiftUI-Animations/Code/Features/App/Models/AppCoordinator.swift - App tabs
SwiftUI-Animations/Code/Features/App/Models/AppTab.swift - Router · Maps gallery selections to standalone demos.
SwiftUI-Animations/Code/Navigation/Router.swift
Discovery
- Animation gallery
SwiftUI-Animations/Code/Features/Home/HomeView.swift - Animation catalog
SwiftUI-Animations/Code/Features/Home/Models/AnimationItem.swift - Gallery cards
SwiftUI-Animations/Code/Features/Home/Views/Support Views/AnimationCardView.swift
Animation components
Self-contained reusable SwiftUI demos.
- Reusable animations · Extractable SwiftUI animations with local state and drawing support.
SwiftUI-Animations/Code/Common/Animations - Auto scroller state
SwiftUI-Animations/Code/Common/Animations/Auto Scroller/ViewModels/AutoScrollerViewModel.swift - Auto scroller
SwiftUI-Animations/Code/Common/Animations/Auto Scroller/Views/AutoScrollerView.swift - Card swap
SwiftUI-Animations/Code/Common/Animations/Cards Swap/Views/CardSwapView.swift - Download button
SwiftUI-Animations/Code/Common/Animations/DownloadButton/DownloadButton.swift
Metal effects
- Shader gallery
SwiftUI-Animations/Code/Features/Shaders/ShaderView.swift - Shader catalog
SwiftUI-Animations/Code/Features/Models/ShaderItem.swift - Ripple effect
SwiftUI-Animations/Code/Common/Shaders/RippleEffect/RippleEffectView.swift - Ripple kernel · GPU pixel-processing implementation.
SwiftUI-Animations/Code/Common/Shaders/RippleEffect/RippleEffect.metal
Platform and delivery
- Xcode project
SwiftUI-Animations.xcodeproj/project.pbxproj - Haptic manager
SwiftUI-Animations/Code/Services/HapticManager.swift - App resources
SwiftUI-Animations/Resources/Assets.xcassets - CI build
.github/workflows/build.yml
Connections 21
- 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