I'm getting a cryptic message from the compiler, and am trying to debug it, since this code worked on one of teammate's machines. Are we using different versions of RXSwift?
How can I bind a UIButton.rx to a PublishRelay of type Void ?
import SnapKit
import RxSwift
import RxCocoa
var startButton: UIButton
var tapStartButtonRelay: PublishRelay<Void>
startButton.rx.tap
.bind(to: tapStartButtonRelay)
//get Cannot invoke 'bind' with an argument list of type '(to: PublishRelay<Void>)'
It seems you are using an outdated version of RxSwift. The code is correct, it works on my machine using RxSwift 4.2.0.
Please update to RxSwift 4.2.0 because it contains this PR, where the Rx Team added the bind(to:)
methods for PublishRelay
and BehaviorRelay
.