Heavy Metal: Creating beauty with SwiftUI shaders
summary
iOS 17 extends SwiftUI so views can run Metal shaders by dropping in .metal files with iOS 17 SwiftUI visual effect and precise stitchable function signatures; SwiftUI handles loading while Metal shading language does per-pixel work. Examples include pass‑through and recolor shaders, a TimelineView‑driven animated gradient, a Distortion wave that needs a max sample offset and view size, a layer effect magnifier with gesture‑driven UV sampling, shape transitions using smoothstep/mix and a Manhattan variant, and a 10‑loop sbow rainbow shader (about 15 MSL lines) that runs interactively on device.
AI-written summary · about
chapters (10)
- 0:00Introduction to Metal shaders
- 6:13Simple shaders in SwiftUI
- 11:09Animated gradients with time
- 12:55Wave distortion effects
- 15:21Relative wave effects
- 18:56Layer effects and zooming
- 23:52Custom transitions with shaders
- 28:28Crosswarp transition effect
- 31:36Complex shader exploration
- 39:09Resources and next steps








