I'm learning RxSwift, what I would like achieve is to get mechanism which prints me text from UITextFied, but after given interval.
How it works now: when I type first character this character is immediately printed out (not after delay how I expected) and if I keep on typing long sentence, text is printed after each two second (as interval is set in throttle), but I would like to have only latest text value.
My code:
inputField.rx.text.orEmpty
.throttle(2, latest: true, scheduler: MainScheduler.instance)
.subscribe(onNext: { text in
print("\(text)")
}, onDisposed: nil)
.addDisposableTo(disposeBag)
Im looking for your help Rx fellows :) Thanks