Skip to main content
LanguageEnglish
Engineering5 min readOctober 2026

How do spring animations work in SwiftUI?

Short answer

In SwiftUI you add a spring with .animation(.spring) or withAnimation(.spring). Since iOS 17 the main settings are duration and bounce, and there are presets: .smooth (no bounce), .snappy (a little) and .bouncy (more). Older code uses response and dampingFraction. SwiftUI springs keep their velocity when a new animation interrupts them, which makes gestures feel natural.

Core Takeaway

  • Use withAnimation(.spring) for state changes, or .animation(.spring, value:) on a view
  • iOS 17+: .spring(duration:bounce:) plus .smooth, .snappy and .bouncy presets
  • Older API: .spring(response:dampingFraction:blendDuration:)
  • Springs are SwiftUI's default animation style since iOS 17
  • Interrupted springs keep their velocity, so gestures hand off smoothly

SwiftUI animates changes in state. When a value such as isExpanded changes inside withAnimation(.spring), every view that depends on it moves to its new layout using a spring.

In iOS 17 and later, the simplest way to describe a spring is with two values: duration, roughly how long it takes to settle, and bounce, how much it overshoots. A bounce of 0 gives smooth motion with no overshoot; higher values add bounce. Apple also provides presets: .smooth, .snappy and .bouncy.

Older code uses .spring(response:dampingFraction:). Response is similar to duration, and a damping fraction of 1 means no bounce while lower values add bounce. Both forms describe the same physical spring.

The big advantage of springs is interruption. If a user taps again or a drag gesture ends mid-animation, the new spring starts from the current position and velocity, so there is no jump. For drag gestures, pass the gesture's velocity when the user releases, so the element continues in the direction it was thrown.

If the same component also needs to run on the web or Android, keeping spring values as shared motion tokens helps. ExodeUI, which we make, has a SwiftUI runtime, so one designed component with its springs can play in SwiftUI and on other platforms.

Frequently asked questions

What is the default animation in SwiftUI?

Since iOS 17, the default animation is a smooth spring.

What is the difference between .snappy and .bouncy?

.snappy settles quickly with a small overshoot; .bouncy overshoots more. .smooth has no overshoot.

How do I convert response and dampingFraction to duration and bounce?

Response roughly maps to duration. A damping fraction of 1 is bounce 0; lower damping fractions mean more bounce.

How do I add velocity from a drag gesture?

Read the velocity when the drag ends and use an interpolating spring or the newer spring APIs that accept an initial velocity.

Related Guides & Examples

Tune a spring before you write code

Drag the sliders, watch the motion, and copy spring values for SwiftUI, CSS and other platforms.

Open the spring generator
ExodeUI

EXODEUI DESKTOP

A little space for good ideas.

Choose your platform to get the official ExodeUI installer.

Looking for Intel Mac or other builds? Explore the web studio or check all download options.

Prefer the browser? Try for free in your browser →