Group Group Group Group Group Group Group Group Group

Chapter 8: Collage - Clear Function fails

Loving the early release previews. In the Collage project, the clear function:
@IBAction func actionClear() {
images.send([])
}

…works perfectly when adding the single image.
However, as soon as you subscribe to the PhotoViewController, it no longer works
As far as i can tell emptying the array on images should work

It appears to be happening due to the completion sent down the publisher chain by the photos view controller in viewWillDisappear. At a guess, the images subject is responding to that by closing itself down, and no longer accepting inputs (or no longer passing them down the chain). Removing the line that sends the completion causes the app to work as advertised.

Interestingly, the subscribers just keep piling up. I’m not clear on whether they’ve even been cancelled.