Category: Swift

Swift
Checked Continuations in Swift: Bridging Callback APIs Without Leaks or Double Resumes

By Seren  |  28 Aug, 2026
Leave a comment

My first continuation wrapper was only six lines long, and I was rather proud of it. A callback came in, I called resume, and an awkward legacy API suddenly worked with async/await. Then a cancellation test sat waiting until the test timeout. The callback API had a branch that returned without calling its completion handler. […]

Swift
Swift Sendable and @unchecked Sendable: A Practical Safety Checklist for Strict Concurrency

By Seren  |  27 Aug, 2026
Leave a comment

When I enabled stricter concurrency checking on an older Swift target, the warning list was long enough to be discouraging. Several types had crossed queues for years without an obvious crash, so adding @unchecked Sendable everywhere looked like the fastest way forward. I tried it on one wrapper and immediately disliked how quiet the compiler […]

Swift
Swift Actor Reentrancy Explained: Why Protected State Can Still Become Stale

By Seren  |  26 Aug, 2026
Leave a comment

The first time actor reentrancy really clicked for me, I was looking at two identical token-refresh requests in the network log. I had moved the token store into an actor, the compiler was happy, and I was convinced duplicate refreshes were no longer possible. Yet there they were, starting only milliseconds apart. My first reaction […]

Swift
Swift Task Cancellation in Practice: Stopping Stale Requests Before They Update the UI

By Seren  |  25 Aug, 2026
Leave a comment

I finally took task cancellation seriously after watching a search screen display the wrong result with perfectly valid network responses. I typed “sw,” paused briefly, and then completed the word “swift.” The second request finished first and the UI looked correct for a moment. Then the slower “sw” request returned and replaced the screen with […]