All posts

Posts tagged with: async await

8 posts found

A single closed door at the end of a long hallway
Swift Concurrency Async Await

A Continuation Can Only Be Resumed Once. Swift Won't Stop You From Trying Twice.

withCheckedContinuation bridges callback-based APIs into async/await, but resuming it twice crashes at runtime and resuming it zero times hangs forever — and the compiler catches neither. Here's the failure shape and the fix.

6 min read
A stopwatch resting on a wooden surface
SwiftUI Async Await

Your Pull-to-Refresh Spinner Vanishes Instantly. Your .refreshable Closure Isn't Actually Async.

SwiftUI's .refreshable modifier hides its spinner the moment your closure returns — not when your data arrives. Here's the fire-and-forget Task bug that causes it, and the fix.

5 min read
Close-up macro shot of a mechanical stopwatch face
Swift Concurrency

Date() Subtraction Lies to You About Elapsed Time. Swift's ContinuousClock Doesn't.

Measuring elapsed time with Date() subtraction quietly breaks when the system clock changes mid-measurement. Swift's ContinuousClock and Duration fix it — here's the difference and when it actually matters.

5 min read
A safety net stretched taut, catching something mid-fall
Swift Swift 6.4

Swift 6.4 Lets Your defer Block Await. withTaskCancellationShield Is Why That's Actually Safe.

Swift 6.4 ships async defer (SE-0493) and withTaskCancellationShield (SE-0504) together, finally letting cleanup code make network calls without racing cancellation. Here's what changes and why the pairing matters.

6 min read
Two runners on parallel tracks, one crossing ahead of the other
SwiftUI Swift Concurrency

SwiftUI's .task(id:) Cancels for You. .onChange Doesn't. That Gap Is Where Your Duplicate Network Calls Live.

.task(id:) and .onChange(of:) both react to a value changing, but only one of them cancels the work it started. Here's the SwiftUI concurrency gotcha that ships silently duplicate requests.

6 min read
A velvet rope queue barrier stand, the kind used to control who enters one at a time
Swift Concurrency Actors

An Actor Isn't a Lock. It's a Line With a Very Specific Rule About Cutting.

Swift actors guarantee that only one task touches their state at a time — except across every await, where a second task can walk right in. Here's what actor reentrancy actually means and the bug pattern it causes.

7 min read
A black digital clock display against a dark background, evoking a countdown running out
Swift Swift Concurrency

Swift Just Got a Real Timeout API. Here's What We've All Been Duct-Taping Instead.

SE-0526 withDeadline was accepted into Swift on July 30, 2026 — a real, composable, absolute-time-limit API for async operations. I found the exact gap it fills in a real app's networking layer, fixed it today's way with a TaskGroup race, and lined it up against what withDeadline will let me delete once it ships.

10 min read
A tangled mass of colorful telephone wires on the left resolving into a neatly organized black patch panel on the right — the same shape as replacing scattered URLSession calls with one clean networking layer.
Swift Networking

A Custom Networking Layer in 100 Lines of Swift — No Alamofire

Day 22 of the 30-day iOS series. URLSession, async/await, a generic Endpoint, and one typed error enum — the entire networking layer is 85 real lines, tested with a URLProtocol stub, and wired into a real BrewLog feature with a real local server.

11 min read