Post not yet marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliesup-voted.tooltip
Replied In
App crashing on cancellable.cancel()
You can totally disregard my original reply. I believe, in looking into this more, that the issue actually lies in the assign(to:_, on:_), operation. This operation seems to be capturing a strong reference to self in the closure and creating issues when the class ImageLoader attempts to deinit. On the documentation side of things it looks like there is a new assign operation that was added to the OS updates from WWDC 2020 that is supposed to solve this issue, but it doesn't appear to return a cancellable (it actually returns Void) meaning that you cant capture the reference to the cancellable the way the code is written now.
Assign 1: https://developer.apple.com/documentation/combine/anypublisher/assign(to:on:)
vs
Assign 2: https://developer.apple.com/documentation/combine/publisher/assign(to:)
It's my working theory right now that the second assign is more inline with what you want without creating a strong reference to self and causing issues on deinit.
Alternatively you can just use the .sink() operator to receive the value from the URLSession publisher. https://developer.apple.com/documentation/combine/publisher/sink(receivevalue:)