Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

claude keeps getting progressive blur headers in swiftui wrong. so i built one that works and open sourced it.

188,369 Aufrufe • vor 2 Monaten •via X (Twitter)

0 Kommentare

Keine Kommentare verfügbar

Kommentare vom Original-Post werden hier angezeigt

Ähnliche Videos

I learned this the hard way: do NOT use SwiftUI if you want your app to look and feel amazing. At least when coding with AI. (sorry, Apple colleagues reading this 😅) I'm sharing my process vibe coding this calorie tracker. I get a lot of questions about the fluid transition in the video. Here's the whole story. Initially, Claude built the grid with SwiftUI. It was quick and easy, and looked good! But the transition to the day view was a boring navigation push/pop. No fun. I wanted something custom. I asked Claude to make it a fluid transition that remaps the food tiles from their source to destination positions. All hell broke loose. Claude tried a bunch of horrible things. Initially it used matched geometry effects, which worked OK but didn't lend themselves well to gesture-driven animations. So it resorted to SwiftUI preference keys + geometry readers to figure out the source and destination positions and calculate the interpolated position based on gesture progress, coordinating across grid and day views. But this meant it had to write a custom layout because it couldn't reposition tiles inside the native SwiftUI grid. And it had to do an awkward handoff between views, which always created ugly pops or jumps. And don't get me started on trying to put it on a bouncy spring, that only made the math 10x buggier. Fortunately, Claude Fable was smart enough to see that this was becoming a disaster (and discover most of the issues itself, in the simulator), so it pivoted away from SwiftUI. Opus might not be so wise, so you'll have to pay attention and intervene. Ultimately, it rewrote it in plain UIKit and everything turned out great. After that, we moved from 2D images to 3D assets, which introduced a new set of performance challenges and yet another rewrite to a single Metal layer, which is what you see below. I can write more about the 2D-to-3D saga if anyone's interested. If I were to do it again, I'd just say "Don't use SwiftUI" from the very first prompt, and save a few hours of headaches. SwiftUI can be amazing for a human iterating directly in code. But agents don't benefit from any of its advantages. Plus, agents have seen decades of UIKit training data, so they're great at writing it, and it's far more flexible. Here's hoping we see more agent-friendly iterations of SwiftUI in the future. Till then, I'm probably going to avoid it.

Anshu

101,850 Aufrufe • vor 4 Tagen