Is a Bug for sendInterrupted() event?
0xBa0 opened this issue · comments
@IBOutlet weak var testButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
self.testButton.reactive.pressed = CocoaAction(self.testAction)
self.testAction.errors.take(during: self.reactive.lifetime).observeValues { (error) in
print("error")
}
self.testAction.completed.take(during: self.reactive.lifetime).observeValues { (_) in
print("completed")
}
self.testAction.events.observeValues { (event) in
print(event)
}
}
lazy var testAction = Action<Void, String, ErrorS> {
[unowned self] _ in
return self.signalA()
.flatMap(.latest, { [unowned self](value) in
return self.signalB()
})
}
func signalA() -> SignalProducer<String, ErrorS> {
return SignalProducer{
(observer, lifetime) in
observer.send(value: "signalA")
observer.sendCompleted()
}
}
func signalB() -> SignalProducer<String, ErrorS>{
return SignalProducer{
(observer, lifetime) in
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 2, execute: {
//Interrupted
observer.sendInterrupted()
})
}
.take(during: self.reactive.lifetime)
.observe(on: UIScheduler())
}
Hi Master,
I wanna interrupt the testAction when executing signalB, but the testAction still can get the completed event.
Please feel free to check it in my source code.
Thanks a lot.
Hello. 👋 Thanks for opening this issue. Due to inactivity, we will soft close the issue. If you feel that it should remain open, please let us know. 😄