SwiftUI Weekly - Issue #216
The curated collection of links about SwiftUI. Delivered every Monday.
Reading
Mesh gradients in SwiftUI
A mesh gradient is a technique for rendering smooth, multi-directional color transitions across a surface using a structured network of control points. Unlike linear or radial gradients, which interpolate color along fixed axes, a mesh gradient defines colors at specific positions within a two-dimensional grid. These positions act as anchors, and the rendering engine computes smooth interpolations between them across the surface.
Demystifying SwiftUI’s .ignoredByLayout() — How to Apply Geometry Effects Without Breaking Your Layout
Among SwiftUI’s many APIs, .ignoredByLayout() is something of an “understated member.” Information is scarce, usage scenarios are uncommon, and its very name tends to raise questions.
Ever heard of .contextMenu()?
Vincent Pradeilles demonstrates how to implement a simple emoji reaction feature in a SwiftUI chat interface using the built-in .contextMenu() modifier. This approach allows developers to add contextual menus that appear upon a long press on a chat bubble, offering various emoji reactions.
XCUITest: How to Write UI Tests for SwiftUI Apps
If you’ve ever shipped a bug where a button did nothing, a sheet didn’t show, or the wrong item appeared on screen—this post is for you.
Videos
Elevate Your SwiftUI Lists with iOS 18’s New Container Features
I’ll walk you through two practical examples: enhancing a basic list with stylized sections and creating a dynamic, filterable to-do list using ContainerValue to elevate a selected section to the top.