3
我不太相信RxSwift,但它確實很難理解。在回顧了不同的材料之後,我不能'繼續工作和操縱序列。 整體來說,我有類型轉換問題:RxSwift conver Observable <Bool> to Observable <Void>
Cannot convert return expression of type 'Observable<Bool>' to return type 'Observable<Void>' (aka 'Observable<()>')
我有CocoaAction處理,並且應該返回Observable<Void>
func stopProject() -> CocoaAction {
return CocoaAction { _ in
let stopProject = stop(project: self.projectId)
return stopProject.asObservable() //wrong converting
}
}
的stop
函數返回Observable<Bool>
完成看法:
return stop(project: self.projectId).flatMap { _ in
Observable<Void>.empty()
}
是的,在某些情況下,您是對的。我在https://github.com/ReactiveX/RxSwift/issues/1206找到了提示 –