I am coming from RxSwift and usually end up binding PublishSubjects
together. I see that in Combine
PassthroughSubject
is the equivalent.
I have tried the following code:
let passthroughSubject1 = PassthroughSubject<Void, Never>()
let passthroughSubject2 = PassthroughSubject<Void, Never>()
private func bindEvents() {
passthroughSubject1
.assign(to: \.passthroughSubject1, on: self)
.store(in: &cancellables)
}
However I get the error Key path value type 'PassthroughSubject<Void, Never>' cannot be converted to contextual type 'Void'
.
Is there not a way to bind two subjects together in Combine
?