

SWIFT PUBLISHER 4 OPEN .PUB UPDATE
Unfortunately, while the initial list is published, the update never arrives. It attempts to subscribe to changes to the list of items, and tries to test that the first update is the initial 63 items, and the subsequent update is for 64 items (in this case, “update” results in adding an item). I attempt to do this by prepending the initial items source to the update PassthroughSubject.īelow that is an XCTestCase that simulates a lengthy initial item load, and adds an update before that load can complete. The latter can arrive before the initial list of items, and thus must be sequenced via Combine to arrive after it. There’s the ItemFeed, which handles fetching a list of items and simultaneously handling item update events. There might be syntax errors in this, as I’ve whittled it down from my (employer’s) code. So here’s a simplified version of what I’ve got. prepend() I could avoid keeping a reference to one of the publishers. What I need is a Subject that enqueues values, but perhaps that’s not so hard to make.

This means I miss any signals sent prior to that. prepend() doesn’t even subscribe to the other publisher until after the first one completes. UpdateĪfter examining Matt’s thorough book on Combine, I settled on. It’s actually a connection to a websocket that gets made at the same time as the first request, and the updates come over the websocket outside of my control. Importantly, I am not able to wait before making the second request. Is there a way to accomplish that with Combine? I'd love to be able to enqueue those secondary results until the first one has finished. I have a situation where my code needs to make one network call to fetch a bunch of items, but while waiting for those to come down, another network call might fetch an update to those items.
