SwiftUI-Animation-Masterclass
Physics-based motion, particles, change effects and transitions for SwiftUI on iOS and macOS.
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
1import SwiftUI2import SwiftUIAnimationMasterclass3 4struct LikeButton: View {5 @State private var likes = 06 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
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












Timeline
Repository opened
1.0.0 tagged; its manifest pointed at source folders that were not in the repository, so it did not build
Simplified: legacy animation modules removed, leaving a demo view and a scroll modifier
Rebuilt as 2.0.0: physics, gestures, particles, change effects and transitions; MobileMotion and SwiftParticles merged in and archived