All posts
Post
Real-time SwiftUI can stutter under bursty feeds due to unbounded buffers, main-actor hot paths, or tasks that outlive their owners. Model each live source as an AsyncSequence with explicit buffering, cancellation, and isolation.
- Expose feeds via
AsyncStream/AsyncThrowingStreamwith.bufferingOldest(N); callfinish()on teardown and test โno emit after cancel.โ - Consume in views with
task(id:); keep mutations on the@MainActorand checkTask.isCancelledinside loops. - Bridge delegates and legacy publishers at repository boundaries into
AsyncStreamso views subscribe to one model. - Coalesce and parse off-main; hop back only for UI. Add
OSSignposteraround parse โ diff โ render to spot stalls. - ๐งช Add async tests for cancel-after-start and run burst scenarios in Instruments;