The following func runs well before I update to Xcode12, I'm new to ReactiveSwift and I don't know how to fix this issue, thanks for you help!
Error message: Cannot convert value of type 'Disposable?' to closure result type 'Void'
public func testFunc(input: Signal<Value, Never>.Event = .completed) -> Signal<Value, Never> {
return Signal<Value, Never> { observer, lifetime in
return self.signal.observe { event in
switch event {
case .value(let value):
observer.send(value: value)
case .failed(_):
observer.send(input)
}
}
}
}
This was a change made in newer ReactiveSwift
versions. Instead of returning a disposable, you should add it to the lifetime
passed to the closure:
public func testFunc(input: Signal<Value, Never>.Event = .completed) -> Signal<Value, Never> {
return Signal<Value, Never> { observer, lifetime in
lifetime += self.signal.observe { event in
switch event {
case .value(let value):
observer.send(value: value)
case .failed(_):
observer.send(input)
}
}
}
}
It seems like there are also some missing cases in that switch
statement though.