All open-source packages
UISwift

SwiftUI-Animation-Masterclass

Physics-based motion, particles, change effects and transitions for SwiftUI on iOS and macOS.

7StarsLatest Release: v2.0.0Updated: October 15, 2026
Platforms:iOS 17macOS 14

License: MIT

A Swift package of motion for SwiftUI on iOS 17+ and macOS 14+: physics-based springs, decay and bounces, drags that keep the speed of the finger, particle effects, change effects and transitions. Everything is a view modifier, an Animation, a Transition or a plain value type, and the package has no dependencies.

Features

  • DampedSpring solved in closed form, with gentle, snappy, bouncy and smooth presets, settling time and conversion to a SwiftUI animation
  • Decay projects where a flick ends; GravityBounce and .gravityBounce() drop a value and bounce it
  • .elasticDrag() and .snapDrag() pass the release velocity to the spring and stretch with rubber-band resistance past the ends
  • Particles in a single Canvas: 8 presets, 5 forces and 7 shapes, a seeded simulation and at most 10,000 particles
  • Change effects (shake, jump, spin, pulse, ping, shine) and iris, wipe, flip and pop transitions
  • Every effect respects Reduce Motion on its own
  • Builds in the Swift 6 language mode; DocC catalog with four articles and the MotionGallery example app for iOS and macOS

Quickstart

swift
1import SwiftUI
2import SwiftUIAnimationMasterclass
3 
4struct LikeButton: View {
5 @State private var likes = 0
6 
7 var body: some View {
8 Button("Like", systemImage: "heart.fill") { likes += 1 }
9 .buttonStyle(.borderedProminent)
10 .changeEffect(.jump(), value: likes)
11 .particleBurst(.hearts, trigger: likes)
12 }
13}

Installation

Swift Package Manager

swift
1dependencies: [
2 .package(url: "https://github.com/muhittincamdali/SwiftUI-Animation-Masterclass.git", from: "2.0.0")
3],
4targets: [
5 .target(name: "YourApp", dependencies: [
6 .product(name: "SwiftUIAnimationMasterclass", package: "SwiftUI-Animation-Masterclass")
7 ])
8]

Screenshots

Confetti and fireworks bursts, snow and embers drawn by ParticleSystem
Confetti and fireworks bursts, snow and embers drawn by ParticleSystem, dark theme
The shake, jump, spin, pulse, ping and shine change effects
The shake, jump, spin, pulse, ping and shine change effects, dark theme
A ball dropped with gravityBounce, a bouncy DampedSpring and a Decay flick
A ball dropped with gravityBounce, a bouncy DampedSpring and a Decay flick, dark theme
Physics lab screen of the MotionGallery example app on an iPhone simulator, light
Physics lab screen of the MotionGallery example app on an iPhone simulator, dark
Change effects screen of the MotionGallery example app, light
Change effects screen of the MotionGallery example app, dark
Transitions screen of the MotionGallery example app, light
Transitions screen of the MotionGallery example app, dark

Timeline

  1. Repository opened

  2. 1.0.0 tagged; its manifest pointed at source folders that were not in the repository, so it did not build

  3. Simplified: legacy animation modules removed, leaving a demo view and a scroll modifier

  4. Rebuilt as 2.0.0: physics, gestures, particles, change effects and transitions; MobileMotion and SwiftParticles merged in and archived

Links

Merged Repositories

Related Article

Read the article