RxSwift emit element from array with interval.

Updated
Feb 19, 2020 1:34 PM
Created
Feb 19, 2020 1:33 PM
Tags
SwiftRxSwift.frameworkMemo
Keywords

Observable<Int>
  .from([1,2,3])
  .concatMap { value -> Observable<Int> in
    Observable.just(value).delay(.seconds(1), scheduler: MainScheduler.instance)
}
.debug()
.subscribe()

Observable<Int>
  .from([1,2,3])
  .concatMap { value -> Observable<Int> in
    Observable.just(value).delay(.seconds(1), scheduler: MainScheduler.instance)
}
.scan([Int]()) { (buf, e) in
  var buf = buf
  buf.append(e)
  return buf
}
.debug()
.subscribe()