Swift Combine: Managing Multiple Threads with AnyPublisher and PassthroughSubject
I have some Combine streams that I am merging together to create some state for a feature I’m building. Will spare the details, but the basic gist of this is that the main stream is responsible for accumulating elements from sub-streams with scan(_:)
. The problematic sub-stream is driven by a PassthroughSubject
that’s called from somewhere else in my app. In reality, there’s more happening in the sub-stream that isn’t important, this is just an example.