I'm using the ReactiveKit's Bond library in my project for the first time and trying to get the hang of it.
In my app, there's a textview. And as the user types in it, an API call needs to fire at three stages.
- As soon as the first character is typed.
- After that each 8 seconds.
- Finally one time after 10 seconds has passed since the user typed the last character.
I'm trying to see if I can accomplish this.
textView.reactive.text
.map { $0!.characters.count > 0 }
.throttle(seconds: 8)
.observeNext { _ in
print("-> Call API")
}
I'm encountering an issue here too. Even though I have the character count validation added, as soon as this code is executed, the Call API gets printed to the console. Without the keyboard even becoming the first responder of the textview.
The method firing in 8 second intervals part works fine. Again I couldn't find a way to implement the third scenario.
Any help is appreciated.