Debugging SwiftUI Image Flickering: Three Bugs Stacked on Top of Each Other

The Problem I was building a music streaming app, and the album artwork kept flickering. Not just during track changes — even while playing the same song, the artwork would briefly disappear and reappear. The blurred background on the full player was especially bad. I figured it was slow image loading, so I added caching. Still flickered. Dug deeper and found three bugs stacked on top of each other. ...

April 21, 2026 · 3 min · Young

Why Storing Closures in SwiftUI @Observable Causes EXC_BAD_ACCESS

What I Was Trying to Do I was building an iOS music streaming app with detail views behind NavigationDestination. Each detail view had its own ViewModel, with API calls injected as closures. Something like this: @Observable final class PlaylistDetailVM { var songs: [Song] = [] var isLoading = false // API methods injected as closures private let fetchSongs: (String) async throws -> [Song] private let addToPlaylist: (String, [String]) async throws -> Void init( fetchSongs: @escaping (String) async throws -> [Song], addToPlaylist: @escaping (String, [String]) async throws -> Void ) { self.fetchSongs = fetchSongs self.addToPlaylist = addToPlaylist } } Created as @State inside NavigationDestination: ...

April 21, 2026 · 3 min · Young