That actually does resolve the issue (I can't control what queue @Published
publishes on, but I can control what I receive on):
This change:
var valuePublisher: AnyPublisher<Int, Never> {
$value.receive(on: DispatchQueue.main).eraseToAnyPublisher()
}
Produces:
closure value: 42
object value: 42
But it drops the initial value which is likely due to the causes outlined in Combine `.receive(on: RunLoop.main)` loses sent value. How can I make it work? - #40 by somu