Skip to content

Instantly share code, notes, and snippets.

@pzmudzinski
Created March 5, 2019 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pzmudzinski/9ac4e59987c61131c793efbdbecce75c to your computer and use it in GitHub Desktop.
Save pzmudzinski/9ac4e59987c61131c793efbdbecce75c to your computer and use it in GitHub Desktop.
extension Observable {
func rebound(after interval: RxTimeInterval, map: @escaping (Element) -> Element = { return $0 }) -> Observable<Element> {
return flatMap { element in
return Observable.just(map(element))
.delay(interval, scheduler: MainScheduler.instance)
.startWith(element)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment