Open-source project
Shubham0812/SwiftUI-Animations avatar
Shubham0812/SwiftUI-Animations

SwiftUI-Animations: 25+ Ready-to-Copy iOS Animations and Metal Shaders

A repository containing a variety of animations and Animated components created in SwiftUI that you can use in your own projects.

3,527 stars317 forksSwiftApache-2.0

At a glance

What is it?
SwiftUI-Animations is a growing gallery of over 25 self-contained SwiftUI animations and Metal shaders for iOS 17 and later. Each animation lives in its own folder with complete source code, runnable as a standalone Xcode preview without launching the full app.
Who is it for?
SwiftUI-Animations is most useful to iOS developers who need a working reference for a specific SwiftUI animation pattern and want production-quality source code rather than tutorial prose. The iOS 17 minimum target rules it out for projects still supporting earlier versions of iOS.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 50 days ago.
What is it written in?
Mainly Swift, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 29, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What SwiftUI-Animations Provides and Who It Is For

SwiftUI-Animations is a collection of over 25 custom animations and Metal shaders built entirely with SwiftUI. It targets iOS developers who want working code for a specific animation pattern: a card shuffle, a download progress circle, a scratch-to-reveal surface, a Yin-Yang toggle, or a GPU-powered fluid grain effect. The value is not tutorials or explanations but source code that compiles and runs. Each animation is self-contained in its own folder under Code/Common/Animations/, with shaders in Code/Common/Shaders/. The repository does not include a package manifest for Swift Package Manager or CocoaPods, which means animations are integrated by copying source files rather than adding a dependency. This design trades convenience for readability: a developer copies exactly the files they need and owns the code outright.

The Animation Gallery: Categories and Named Examples

The gallery spans loaders, interactive controls, and GPU effects. The loader category includes Circle Loader, Pill Loader, Infinity Loader, 3D Rotating Loader, Book Loader, Triangle Loader, Spinning Loader, and GitHub Octocat Loader. Interactive controls include the Yin-Yang Toggle, a Like Button, a Submit Button, an Add Item view, and an Add to Cart flow. The Auto Scroller and Chat Bar cover UX motion patterns. Three entries marked as new at the time of the last push are Fluid Grain (a Metal shader), 3-D Graph, and Cards Shuffle. The Animated Login demonstrates how to combine multiple animations in a single view. A Card Viewer shows banking-card presentation effects. The Light Bulb and Light Switch animations implement state-change effects. Each gallery entry in the README links directly to its folder in the repository, so a developer can navigate to any animation's source with a single click.

Getting Started: Clone, Open, and Browse

The project requires Xcode 16.0 or later, iOS 17.0 or later, and Swift 5.0 or later. The README gives these commands:

bash
git clone https://github.com/Shubham0812/SwiftUI-Animations.git
cd SwiftUI-Animations
open SwiftUI-Animations.xcodeproj

After the project opens in Xcode, select an iOS simulator (iPhone 14 or later is recommended in the README) from the device picker and press Command-R to build and run. The app launches with a home screen listing all available animations; tapping any card opens it full-screen for interactive testing. The README also notes that every view file includes a PreviewProvider or a #Preview macro, so individual animations can be run in Xcode Previews by opening the file and pressing Command-Option-P, without launching the full app. The source for each animation is in a dedicated subfolder under Code/Common/Animations/ and can be read directly in Xcode's Project Navigator.

Metal Shaders in the Collection

The newest additions to the repository include GPU-powered effects under Code/Common/Shaders/. The Fluid Grain shader is listed separately from the animation folders, reflecting a different technical path. SwiftUI added a shader modifier API that allows Metal shaders to be applied directly to SwiftUI views as visual effects, which is the mechanism used here. These shader-based entries require iOS 17 as a minimum target because the SwiftUI shader API was introduced in that release. A developer targeting iOS 16 cannot use these entries without rewriting them in Core Image or similar. The README does not document what the shader inputs are or how to configure them beyond what is visible in the source files themselves; reading the shader source in its folder is the intended discovery method.

Limitations and When SwiftUI-Animations Is the Wrong Tool

The iOS 17 minimum requirement is the most significant constraint. Apps distributed through the App Store that still support iOS 15 or iOS 16 cannot use the Metal shader entries and may find that some animation APIs relied on elsewhere in the project are unavailable on older targets. The repository has no Swift Package Manager manifest, so there is no managed dependency path; integration is purely by copying source. There are no unit tests or snapshot tests for any animation, meaning visual regression testing after customization is manual. The animations are demonstrations rather than configurable components: they do not expose configuration parameters through environment objects or SwiftUI view modifiers beyond what is in each file's source. Adapting an animation to a different color scheme or timing requires editing the file directly.

SwiftUI-Animations vs. Lottie for iOS

Lottie (by Airbnb) is a widely used alternative for iOS animations. The core difference in approach is the source of truth: Lottie plays back animations defined in JSON files exported from tools like After Effects or dotLottie, while SwiftUI-Animations provides animations written directly in Swift using SwiftUI modifiers and Metal shaders. Lottie is better suited for complex multi-layer animations designed by motion designers in external tools. SwiftUI-Animations is better for developers who want animation logic written in Swift, readable as ordinary SwiftUI code, and adjustable at the source level without a separate design tool. Lottie also integrates as a Swift Package, making it straightforward to add as a dependency. SwiftUI-Animations requires manual file copying. Neither addresses the other's use case well.

Maintenance and License

The last push to SwiftUI-Animations was on 2026-08-11. The repository is licensed under Apache-2.0, which permits use, modification, and distribution in commercial projects. The Apache-2.0 license requires preserving copyright notices and the license text in distributed copies; it also requires that changes to licensed files be documented. The repository includes CHANGELOG.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md, suggesting a structured contribution process. A continuous integration workflow is referenced in the README badge. Contributions follow the CONTRIBUTING.md guidelines available in the repository root.

Editorial conclusion

SwiftUI-Animations is most useful to iOS developers who need a working reference for a specific SwiftUI animation pattern and want production-quality source code rather than tutorial prose. The iOS 17 minimum target rules it out for projects still supporting earlier versions of iOS. Before integrating any file, check the Apache-2.0 license requirements and verify that the animation renders correctly on the oldest iOS version your app must support.

Frequently asked questions

How do SwiftUI animations work?

SwiftUI animations are driven by state changes: when a state variable changes, SwiftUI interpolates between the old and new view layouts according to the animation modifier applied. SwiftUI-Animations demonstrates this pattern across 25+ examples, from simple toggle transitions to GPU-powered Metal shaders applied as view modifiers on iOS 17 and later.

What are the downsides of using SwiftUI?

SwiftUI requires a minimum iOS version that matches the APIs used. SwiftUI-Animations sets iOS 17.0 as its minimum target, which excludes devices running iOS 16 or earlier. The README does not document workarounds for older targets, and the Metal shader entries depend on SwiftUI APIs introduced in iOS 17.

Can I use SwiftUI-Animations without Swift Package Manager?

Yes. The repository has no Swift Package Manager manifest. Integration is done by copying the source files for the specific animation you need from their folder under Code/Common/Animations/ directly into your Xcode project. There is no managed dependency to add.

Official sources

  1. Issues
  2. License: Apache-2.0
  3. README
  4. Shubham0812/SwiftUI-Animations on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/shubham0812-swiftui-animations.svg)](https://hysenlabs.com/projects/shubham0812-swiftui-animations)