Code Room
Vibe codingMediumvc-g250
Subject Ai code reviewLevel Mid–Senior~16 minCommon in Concurrency interviewsIndustries Software development

Question

An AI wrote this SwiftUI image thumbnail that downsamples a large photo before display. It works, but scrolling a grid of these stutters badly and the watchdog occasionally kills the app on launch when many cells appear at once. What's wrong and how would you fix it?

swift
struct Thumb: View {    let url: URL    var body: some View {        let data = try! Data(contentsOf: url)          // sync download/disk read        let img = downsample(data, to: CGSize(width: 100, height: 100))        return Image(uiImage: img).resizable()    }}
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.