Simulating Touch Physics in SwiftUI

December 4, 2025

This is an exploration of creating touch interactions that feel more physical and responsive in mobile applications. Rather than static tapping mechanics, I experimented with UI surfaces that behave like water — rippling outward when touched, creating the sensation of interacting with actual material rather than flat graphics.

Step 1: Building a Touchable Metal Surface

The implementation uses a MetalView that bridges into UIKit and captures gesture input. Both tap and pan interactions trigger a ripple function, which converts screen coordinates into normalized UV space (0-1) and stores ripple data including center position, start time, and strength.

Step 2: Making the Ripples Feel Right

For believable ripples, they must expand at natural speed, fade over time, and avoid making the entire UI wobbly. The shader computes UV distortion from all active ripples using Gaussian functions around the expanding radius for a soft, water-like appearance. Age and distance falloff make ripples fade over time, and aspect correction prevents circles from becoming ellipses.

Step 3: Warping Objects with the Ripple

Objects are sampled at distorted UV coordinates rather than raw UV, creating the effect that everything sits within something physical. The fragment shader reads the distorted coordinates and renders each sticker at its warped position.

Step 4: Letting Waves Move Objects Around

Each sticker maintains physics state with position and velocity. When ripples reach objects, they experience impulses in the direction of travel. Impulses decay over time, and objects drift slightly then ease back to rest through damping.

Step 5: Keeping "Hello" Anchored

The "hello" text remains pinned while still participating in distortion. During physics updates, it's skipped from force application. In the shader, hello still uses distorted UV but with reduced movement scaling. This creates contrast — other objects float and drift while "hello" remains a stable anchor in the moving world.

Lessons Learned

  • Gestures to UV space to physics to shading provides a solid mental model for touch
  • Small motion amounts combined with lighting changes effectively sell physical surface illusions
  • Swift and Metal work well for interaction design with simple pipelines
  • Making things feel right consumed more time than making them function

The broader takeaway: design UI that doesn't just change state when tapped but actually reacts as if touched — with weight and texture.

© 2026 Vanderpant LLC