Modern SwiftUI Callbacks using AsyncStream
summary
Argues that continuous callbacks belong to async sequences not one‑shot async/await, and demonstrates concrete rewrites: CLLocationManager delegates → an async throwing stream feeding a client with a for try await loop; Combine’s PassthroughSubject replaced by AsyncSequence; Firestore snapshot listeners exposed as an async sequence combined with Firebase Auth state via flatMap to filter by userId. Shows continuation-based implementation, how to yield snapshots and handle errors and cancellation, and claims the resulting code is simpler, testable, and works for continuous real‑time updates.
AI-written summary · about
chapters (10)
- 0:00Introduction and context
- 2:22Speaker background
- 3:36Evolution of programming
- 7:16The problem of blocking
- 10:02Handling async events
- 15:34Combine and concurrency
- 18:27Async sequences
- 21:49Firebase integration
- 26:00Auth and data streams
- 29:49Conclusion and benefits
related talks
18mFloating Down an AsyncStream
27mAsync/Await: Thinking beyond Combine
35mThe Multi-Threaded Asynchronous Parallel World of Swift
32mCombine and your existing delegates and callbacks
47mManaging Combine, your existing code, and async/await
42mAsync Await and More in Swift
44mSwift 6, Async/Await, SwiftUI went into a Bar...
24mAsync/await in Swift
