SwiftUI Effects
Metal shaders that run inside an app's views as SwiftUI effects: color, distortion and layer effects, from the playground to Xcode.
Take them in this order: each one uses what the ones before it showed. The same shaders, newest first, are on the topic’s page.
Sign in and the exercises you pass are marked here. Nothing is kept otherwise.
- Step 1 of 2
Heat Haze
The air over a fire as a SwiftUI layer effect. Each point of the view is shown from a little way down the slope of a field of warm and cool pockets that rises from the fire, widens and fades as it climbs, so the room behind the flame wavers and the flame itself swims. The same file runs in SwiftUI as it is.
Teaches: A SwiftUI distortion effect, from Metal to an app
Builds on Flowing Color Field
Read the page Open in the playground
1 exercise
- Find the bug Put it right · passed
- Step 2 of 2
Frosted Glass
A pane of frosted glass as a SwiftUI layer effect. Each point of the pane shows the average of sixteen samples of the view around it, on a spiral; each tiny facet of the rough surface moves and turns its spiral its own way, which is the grain; the pane has an edge, a rim and a shadow, and frost that lies thick in places and thin in others. The color of the glass isn't in the shader: SwiftUI passes it as an argument.
Teaches: A layer effect that scatters what is behind it, tinted by a color SwiftUI passes
Builds on Flowing Color Field, Heat Haze
Read the page Open in the playground
4 exercises
- A pane with an edge Make this step · passed
- The color of the glass Make this step · passed
- Match the sliders Find the values · passed
- Find the bug Put it right · passed
Other paths Start here Noise & Texture Shapes & Symmetry 3D Scenes Particles & Simulation Light & Materials Atmosphere Fractals Geometry Sound & Rhythm

