Build a Jumping Ball Animation using SwiftUI
viaGlassdoor
Requirements: Live-code a simple animation in SwiftUI where a ball repeatedly "jumps" (moves up and down, simulating a bounce), demonstrating understanding of SwiftUI's state and animation APIs.
Design/Approach: Use a @State property to track the ball's vertical offset, and drive the animation with withAnimation (or an Animation.easeInOut(...).repeatForever(autoreverses: true) modifier) to interpolate the offset between a low and high position, applied via .offset(y:) on a Circle() view. Discussion typically extends to how SwiftUI's declarative state-driven rendering differs from manually managing animation timers in UIKit.
asked …