I'm new in RXSwift and i defined an Observable interval timer sequence that calls a webservice method every second. In that webservice response, i receive new retry time value that must replace with my current time. How to reset this sequence with new time value? This is my code :
func mySequence() {
/////////////////////////////////////// subscribe to Timer (time change)
var time = try! self.timer.value()
self.disposeTimer = timer.subscribe({ value in
time = value.element!
print("=============================\(String(describing: time))=======================================")
})
/////////////////////////////////////// subscribe to Timer (time change)
let observable = Observable<Int>.interval(TIME I NEED TO CHANGE After response , scheduler: MainScheduler.instance).map { _ in ()
self.myWebserviceMethod()
}
disposable = observable.subscribe(onNext: {num in
}, onError: { err in
}, onCompleted: {
}, onDisposed: {
})
}
everything happens but interval timer time is still the old value :(