Closed kevinrenskers closed 4 years ago
Never mind :)
extension Signal {
func errorToOptional() -> Signal<Element?, Never> {
return Signal<Element?, Never> { observer in
return self.observe { event in
switch event {
case .next(let element):
observer.receive(element)
case .failed:
observer.receive(nil)
case .completed:
observer.receive(completion: .finished)
}
}
}
}
}
How do I turn a
Signal<SomeThing, Error>
intoSignal<SomeThing?, Never>
?