I would like to update some variables with values received when handling a newly published value. For example, given:
class ProductViewModel: ObservableObject {
@Published var PublishedX: Int = 0
@Published var PublishedY: Int = 0
@Published var PublishedProduct: Int = 0
// ...
init() {
productPublisher = Publishers.CombineLatest(external.XPublisher, internal.YPublisher)
// .assignAndContinue(\.PublishedX, \.PublishedY) // something like this
.flatMap(MyPublishers.secretMultiplication)
.assign(to: \.PublishedProduct, on: self)
}
}
I would like to also assign the new values of XPublisher and YPublisher to variables (PublishedX and PublishedY respectively).
Is there a way to set these two variables and then continue handling the event?