Redirecting Publisher errors19 Dec 2020 ⇐ Notes archive
(This is an entry in my technical diary. There will likely be typos, mistakes, or wider logical leaps — the intent here is to “[let] others look over my shoulder while I figure things out.”)
Adam Sharp posted a snippet in iOS Folks today that I wanted to highlight (with a couple of light CombineExt-imported edits).
This is a form of materialization that feels more at home in Combine. It tucks away the awkward
errors dance and instead focuses on funneling a publisher’s errors directly to a
It’s tempting to use
(1) — and Adam avoided it for good reason.
autoconnects, which could accidentally trigger a subscription too early at the
assign call at
(2). Instead, he wired up the error-focused publisher to a multicasted
PassthroughSubject (which returns a
ConnectablePublisher) and then makes sure both subscriptions are properly teed up by
autoconnecting the returned publisher at