Spring Animation
iOS 17.0The iOS 17 spring API — describe duration and bounce, not physics constants.
struct SpringDemo: View {
@State private var expanded = false
var body: some View {
VStack {
RoundedRectangle(cornerRadius: expanded ? 40 : 12)
.fill(Color.accentColor)
.frame(width: expanded ? 160 : 80, height: 80)
Button("Toggle") { expanded.toggle() }
}
// iOS 17: duration + bounce is far easier to reason about than
// response/dampingFraction. bounce 0 = smooth, 0.5 = very springy.
.animation(.spring(duration: 0.45, bounce: 0.35), value: expanded)
}
}