我的代码如下所示:
private let myPublishSubject = PublishSubject<Bool>()
func method(input: String) -> String {
if input == something {
myPublishSubject.onNext(true)
return update(input)
}
myPublishSubject.onNext(false)
return input
}
// Output
let driver: Driver<String>
init() {
let myObservable = Observable.just("a")
driver = Observable.combineLatest(myObservable, myPublishSubject)
.map {
...
}
.asDriver()
}
现在,在调试中,我发现driver
只有订阅和处置。之后method
调用时,没有任何订阅者myPublishSubject.onNext
。我该如何解决?