Member-only story
The House Jack Built: SwiftUI Metal Shaders at the Table
Table Ready: Vegas Tutorial draws its felt, dice, baccarat squeeze, and roulette wheel with SwiftUI’s shader modifiers. The Metal turned out to be the easy part. Getting the right numbers into it is where the time went.
Table Ready: Vegas Tutorial puts nine Metal shaders on the table, all through SwiftUI’s shader modifiers. The felt has a lamp hanging over it. The dice have drilled pips. A baccarat card curls up off the felt when you squeeze it, and the roulette wheel blurs while it spins and sharpens as it slows.
Not a Medium member? No problem. You can read this one free on my blog: https://www.wesleymatlock.com/swift-task-names-instruments-lldb/
Honestly, none of the Metal was hard. Each shader answers one question for one pixel, and the longest one is about forty lines. The work was in the numbers going in. SwiftUI won’t hand you a velocity, the sample offset is yours to work out, animated values never reach the shader, and the felt texture just disappeared on the dark theme.
Table Ready: Vegas Tutorial is my casino table-game trainer for iPhone. In the visualEffect post I put colorEffect, distortionEffect, and layerEffect in the list of effects you can return from that closure and then walked right past them. This one's about those three, one table at a time.









