我收到此错误:
无法转换类型'的值((ObserveOnSerialDispatchQueueSink, 事件) - >一次性)!”预期参数类型'(_) - > 一次性'
以下是我的代码:
final fileprivate class ObserveOnSerialDispatchQueueSink < O: ObserverType >: ObserverBase < O.E > {
let scheduler: SerialDispatchQueueScheduler
let observer: O
let cancel: Cancelable
var cachedScheduleLambda: ((ObserveOnSerialDispatchQueueSink < O > , Event < E > ) - > Disposable) !
init(scheduler: SerialDispatchQueueScheduler, observer: O, cancel: Cancelable) {
self.scheduler = scheduler
self.observer = observer
self.cancel = cancel
super.init()
cachedScheduleLambda = {
sink,
event in
sink.observer.on(event)
if event.isStopEvent {
sink.dispose()
}
return Disposables.create()
}
}
override func onCore(_ event: Event < E > ) {
let _ = self.scheduler.schedule((self, event), action: cachedScheduleLambda) //error
}
override func dispose() {
super.dispose()
cancel.dispose()
}
}